Tag Archives: Set new name in RMAN

Issue with Set New name for datafile and tempfile or Use of switch datafile all in Oracle

Set New name for datafile and tempfile in RMAN

To change the location in an Oracle database during an RMAN restore or duplicate operation, use the SET NEWNAME command.

Use ‘SET NEWNAME FOR DATAFILE’ and ‘SET NEW NAME FOR TEMPFILE’ in the run {} block during restore or duplication.

The ‘SET NEWNAME’ command replaces other methods for renaming database files.

If the destination server has a different file system layout and the files need to be restored to different directories than those of the source database, use the ‘SET NEWNAME’ command for each datafile and tempfile (the ‘SET NEW NAME FOR TEMPFILE’ command is available in Oracle 11g).

Note: If ‘SET NEWNAME’ commands are used in a ‘run {}’ block while performing a restore operation, the ‘run {}’ block must contain the command ‘SWITCH DATAFILE ALL;’ and ‘SWITCH TEMPFILE ALL;’ (SWITCH TEMPFILE ALL; is available starting from Oracle 11g).

If the SWITCH; command is missed during a restore, use the ‘ALTER DATABASE RENAME FILE’ command for each datafile before recovery. You can find the details for this in the alert log. This can be tedious, so always remember to include the SWITCH commands in the run block when performing an RMAN restore. For database duplication with the DUPLICATE command, ‘SWITCH DATAFILE/TEMPFILE’ commands are not needed, as RMAN handles this automatically.