Set New name query for using in RMAN Backup Utility

Set new name script for using in RMAN Backup Utility

During RMAN duplicate command you need to set the new name for datafiles
 
From this following script you can only give location of new it will automatically replace and give you the list of data files and log file with set newname syntax as location you modified in following script:
 
It is very helpful if you have large environment like having 100 data files present in production environment and you need to created duplicate of it in Test Environment.
 
Script as follows:

select 'set newname for datafile '||file#||' to "'||
replace(name,'/local/data/oracle/DEVDB/datafiles/','/data10/oradata/DEVDBNEW/')||"';'
from v$datafile where name like '%/datafiles/%'
union all
select 'set newname for datafile '||file#||' to "'||
replace(name,'/local/data/oracle/DEVDB/','/data10/oradata/DEVDBNEW/')||"';'
from v$datafile where name not like '%/datafiles/%';select 'sql "alter database rename file ""'||member||""' to ""'
||replace(member,'/local/data/oracle/DEVDB/redo/','/data10/oradata/DEVDBNEW/')||""'";’
from v$logfile;

Advertisements

One thought on “Set New name query for using in RMAN Backup Utility

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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.