Naming Duplicate datafile names

                    Naming Duplicate Database Files

When you duplicate a database, RMAN generates names for the database files in the duplicate database. This includes the control files, data files, temp files, and online redo log files.

Depending on your duplication scenario, you can name the duplicate database files by using one of the following techniques:

a. Using the Same Names for Database Files in the Source Database and Duplicate Database
b. Using Different Names for the Database Files in the Source Database and Duplicate Database

RMAN uses the same file names and directory structure as the source database for the duplicate database when the process is not specifing a strategy to generate names for duplicate database files. 

When duplicating to a remote host then use NOFILENAMECHECK clause to indicate that RMAN must not display an error when the names of the database files are the same in the source and duplicate database.

Some of the methods used to specify alternate names for duplicate database files may generate file names that are the same as the ones used by the source database. 

This may happen if, for example, you used the SET NEWNAME or the CONFIGURE AUXNAME commands to specify names for the duplicate database files. 

Caution:

Use caution when you specify the file names for the duplicate database, else you may mistakenly overwrite the source database files.

Using the Same Names for Database Files in the Source Database and Duplicate Database
=====================================================================================

Prerequisite Conditions to be met to use the same names for files in the source and duplicate database.

1. If the source database files are Oracle Managed Files, then the auxiliary instance must set the DB_CREATE_FILE_DEST      parameter to the same directory location as the source database. Although the directories are the same on the source and    destination hosts, Oracle Database chooses the relative names for the duplicate files.

2. If the names of the database files in the source database contain a path, then this path name must be the same in the    duplicate database.

For Oracle Real Application Clusters (RAC) environments, use the same value for the ORACLE_SID parameter of the source and destination databases.

When you configure your environment as suggested, no additional configuration is required to name the duplicate files.

Using Different Names for the Database Files in the Source Database and Duplicate Database
==========================================================================================

1. If the source host and the destination host use different directory structures, or 
   if they use the same directory structures but you want to name the database files differently, then 
   you must specify how RMAN should generate names for the duplicate database files.

Note:It is recommended that you use different names for the ASM disk groups in the source and duplicate database.

Methods of Generating Database File Names for the Duplicate Database
====================================================================

Depending on the method that you choose, 

RMAN can either automatically generate file names or 
RMAN use specific names for the duplicate database files. 

The database files include the data files, control files, online redo log files, and temp files.

Use one of the following methods, listed in the order of precedence, to generate file names for the duplicate database:

SET NEWNAME command
===================
Provides specific names for the duplicate database files. Based on your requirement, use the 

SET NEWNAME FOR DATABASE, 
SET NEWNAME FOR DATAFILE, 
SET NEWNAME FOR TABLESPACE, or 
SET NEWNAME FOR TEMPFILE command.

For OMF and ASM database files, you must use the 

SET NEWNAME...TO NEW comand and not explicitly provide names for the database files.

CONFIGURE AUXNAME command
=========================

Specifies non-OMF and non-ASM alternative names for duplicate database files.

SPFILE clause of the DUPLICATE command

Sets all the necessary initialization parameters that are related to duplicate database file names, with the exception of the DB_FILE_NAME_CONVERT parameter.

(Online redo log files only) LOGFILE clause of the DUPLICATE command

Names online redo log files in the duplicate database. You cannot use this method while creating a standby database.

Note:

When duplicating to the local host or to a remote host without the NOFILENAMECHECK clause, ensure that you do not use the name of an online redo log file that is currently in use by the source database.

DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT initialization parameters

Specifies a rule for converting file names in the source database to names in the duplicate database. You can specify multiple conversion pairs.

When you use the DB_FILE_NAME_CONVERT parameter for ASM file names, only disk group name changes must be performed.

Note:

If the source database uses Oracle Managed Files, then you cannot use this method to specify alternative names for duplicate database files.

DB_CREATE_FILE_DEST and DB_CREATE_ONLINE_LOG_DEST_n parameters

Creates Oracle Managed Files at the location specified by these parameters. This is the recommended method to specify alternative names for OMF and ASM.

If more than one method is used to specify alternate names for duplicate database files, then 
the order of precedence decides which technique is used to name files. 

Any files that are not renamed by a particular method are renamed by the method that follows it. For example, if two data files are not included in the SET NEWNAME command, then these data files are renamed by using the DB_FILE_NAME_CONVERT parameter.

Specifying Alternative Names for Duplicate Database Files

The DUPLICATE command in Oracle Database Backup and Recovery Reference for the LOGFILE and SPFILE clauses

Preventing File Name Checking During Database Duplication

It is possible for the 

CONFIGURE AUXNAME command, 
the SET NEWNAME command, or 
the DB_FILE_NAME_CONVERT parameter to generate a name that is already in use in the target database. 

In this case, RMAN displays an error during duplication. 

When duplicating to a remote host, use the NOFILENAMECHECK option to avoid this error message.

Note:

Using NOFILENAMECHECK when duplicating to the local host overwrites the target database files.Generating Names for Control Files in the Duplicate Database

By default, RMAN creates the control file in the default location in the duplicate database. 
You can specify alternate files names and directory names to store the duplicate database control files. 

Caution:

While choosing names for the control files, ensure that you do not mistakenly overwrite the control files of the source database.

Use one of the following techniques, listed in the order of precedence, to specify the location of the duplicate database control files:

1. Set the CONTROL_FILES initialization parameter in the auxiliary instance's initialization parameter file.

2. Create an OMF-based control file in a location which is determined by setting one of the following parameters:

    DB_CREATE_ONLINE_LOG_DEST_n
    DB_CREATE_FILE_DEST
    DB_RECOVERY_FILE_DEST

If more than one of these parameters is set, then the order of precedence used is the order in which these parameters are listed.