这篇文章主要介绍了数据库中如何使用SET NEWNAME FOR,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
这篇文章主要介绍了数据库中如何使用SET NEWNAME FOR,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
SET NEWNAME FOR后面必须带SWITCH DATAFILE ALL或SWITCH TEMPFILE ALL
RUN {
SET NEWNAME FOR DATAFILE 1 to '/oracle/ora11g/oradata/system01.dbf';
SET NEWNAME FOR DATAFILE 2 to '/oracle/ora11g/oradata/sysaux01.dbf';
SET NEWNAME FOR DATAFILE 3 to '/oracle/ora11g/oradata/undotbs01.dbf';
SET NEWNAME FOR DATAFILE 4 to '/oracle/ora11g/oradata/users01.dbf';
SET NEWNAME FOR DATAFILE 5 to '/oracle/ora11g/oradata/undotbs02.dbf';
SET NEWNAME FOR DATAFILE 6 to '/oracle/ora11g/oradata/test01.dbf';
SET NEWNAME FOR TEMPFILE 1 to '/oracle/ora11g/oradata/temp01.dbf';
RESTORE DATABASE;
SWITCH DATAFILE ALL;
SWITCH TEMPFILE ALL;
}
run{
set newname for datafile '/MM/DataYY.dbf' to '/NN/DataYY.dbf';
set newname for tempfile '/MM/TempYY.dbf' to '/NN/TempYY.dbf';
restore database;
switch datafile all;
switch tempfile all;
}
MM是原路径,NN是新路径
只转换DATAFILE时如下
run{
set newname for datafile '/MM/DataYY.dbf' to '/NN/DataYY.dbf';
restore database;
switch datafile all;
}
switch datafile all、switch tempfile all的作用就是在控制文件里面把数据文件路径改过了
If you need to restore a data file to a new location, then use the RMAN SET NEWNAME command within a RUN command to specify the new file name. Afterward, use a SWITCH DATAFILE ALL command, which is equivalent to using the sql statement ALTER DATABASE RENAME FILE, to update the control file to reflect the new names for all data files for which a SET NEWNAME has been issued in the RUN command.
感谢你能够认真阅读完这篇文章,希望小编分享的“数据库中如何使用SET NEWNAME FOR”这篇文章对大家有帮助,同时也希望大家多多支持编程网,关注编程网数据库频道,更多相关知识等着你来学习!
--结束END--
本文标题: 数据库中如何使用SET NEWNAME FOR
本文链接: https://lsjlt.com/news/69808.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0