Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

RMAN set newname Command

Expert Oracle Database Tips by Donald BurlesonMarch 25, 2015

RMAN Using set newname to Change the Restored File Location

As default, RMAN restores a backup of a datafile to its default location. To change this behavior, use the set newname command to define a new location for the restored datafile.

Prior to Oracle 11gR2, this command was used to rename the datafiles and tempfiles. But starting from Oracle 11gR2, you can rename all datafiles in any tablespace and even the whole database files. Moreover, these new options come with new substitution variables which help to change the set of filenames at once. See the usage of these options and substitution variables in real examples.

  • Using set newname for datafile

RMAN> run
 {
    set newname for datafile 4 to '/tmp/datafile4.dbf';
    restore datafile 4;
 }
executing command: set newname

channel ORA_DISK_1: restoring datafile 00004 to /tmp/datafile4.dbf

  • Using set newname for tempfile

To create a tempfile in a new directory while cloning the database, use the set newname for tempfile to ?. command as follows:

RMAN> run
    {
           set newname for tempfile 1 to /tmp/temp01.dbf';
           duplicate database;
    }
 

RMAN will create a new tempfile with a specified name after the database is recovered and opened.

  • Using set newname for tablespace       

This option is used to change all datafiles in a specified tablespace. When using this option, you must use a substitution variable to avoid name collisions. Here is the list of substitution variables which are used during name conversion: 

  • %b:  Specifies the file name without the directory that it locates.

  •  %N:  Specifies the tablespace name

  • %f:  Specifies the absolute file number of a datafile

  • %I:  Specifies DBID

  • %U:  Specifies system generated unique filename as a following format:  data-D-%d_id-%I_TS-%N_FNO-%f

See the following example to understand these substitution variables. In the following example, the %b, %N and %f variables are used:

RMAN> run
2> {
3> set newname for tablespace users to '/tmp/db/%n_%f_%b';
4> restore tablespace users;
5> }
 
output file name=/tmp/db/USERS_4_users01.dbf RECID=8 STAMP=728496167
output file name=/tmp/db/USERS_5_user02.dbf RECID=9 STAMP=728496168

By using the %U variable, you can get the system-generated unique filename. Look at the following example:

RMAN> run
2> {
3> set newname for tablespace users to '/tmp/db/%u';
4> restore tablespace users;
5> }
output file name=/tmp/db/data_d-test_ts-users_fno-4 recid=10
stamp=728496242
output file name=/tmp/db/data_d-test_ts-users_fno-5 recid=11 stamp=728496243

  • Using set newname for database          

This option is used to set a new name for all datafiles and tempfiles in a database. This option is also used with one of the above mentioned substitution variables.

 

 

 
 
 
Get the Complete
Oracle Backup & Recovery Details 

The landmark book "Oracle Backup & Recovery: Expert secrets for using RMAN and Data Pump " provides real world advice for resolving the most difficult Oracle performance and recovery issues. Buy it for 40% off directly from the publisher.
 


 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster