RMAN Switch command script to rename the datafile

Overview: RMAN switch command is equivalent to the alter database rename file. By default the RMAN will restore the file to the original location of the file and it will overwrite the file already present in the original location. If you wanted to restore a datafile to different location you need to run “set rename” command.
rman target /
RMAN > run {
copy datafile '/data/oracle/oradata/proddb9/test.dbf' TO '/data/oracle/oradata/backup/test.dbf';
set newname for datafile '/data/oracle/oradata/proddb9/test.dbf' to '/data/oracle/oradata/backup/test.dbf’;
switch datafile all;
host 'rm /data/oracle/oradata/proddb9/test.dbf ';
DBA Tips Data Pump Reference


Post a Comment


dba topics. Copyright 2011-16 All Rights Reserved | Site Map | Contact | Disclaimer | Google