您好,登錄后才能下訂單哦!
這篇文章主要介紹了數據庫中如何使用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”這篇文章對大家有幫助,同時也希望大家多多支持億速云,關注億速云行業資訊頻道,更多相關知識等著你來學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。