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

For Changing the location in Oracle database in RMAN restore operation or duplicate. We will need to use the SET NEWNAME Command.

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

When specified, the ‘SET NEWNAME’ command will take precedence over the other methods of renaming the database files.

If the destination server follows a different file system layout and if the files needs to be restored to a separate set of directories different than that from the source database, ‘SET NEWNAME’ command needs to be used for each datafile and tempfile (‘SET NEW NAME FOR TEMPFILE’ command is introduced 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 out during a restore operation, ‘ALTER DATABASE RENAME FILE’ command must be used for each datafile before proceeding with the recovery. The details required to perform the manual execution of ‘ALTER DATABASE RENAME FILE’ can be found from the alert log. It is a tedious task to do so, so NEVER forget to add the SWITCH commands in the run block if you are performing an RMAN restore. For database duplication using DUPLICATE command, ‘SWITCH DATAFILE/TEMPFILE’ commands are not required as this function is handled by RMAN automatically.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.