Active Database Cloning fails with RMAN-05001

I am trying to clone a Production database which is of 1.5 TB to our test server , I can even do this with the backup based duplication using RMAN , but there will some huge time which spends on my database backup and the network transfer of my backup file to my test server.

So i decided to use a cool feature of Active database duplication in 11g R2 . There main advantage of active db duplication is there is no need source database backup , RMAN will take care of coping the files from the source to the destination server .

Source DB Name = Prod
Destination DB name = Clone

I have copied the Password file of the source database to the destination server and

$ scp orapwProd oracle@hostname.localdomain.com:/opt/oracle/app/11.2.0.3/dbs/

I have created a pfile for my clone database as follows in the default location of /opt/oracle/app/11.2.0.3/dbs/

$ cat initclone.ora

*.control_files='/opt/oracle/clone/control01.ctl','/opt/oracle/clone/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='clone'
*.db_file_name_convert='/opt/oracle/oradata/prd/datafile/','/opt/oracle/clone'
*.log_file_name_convert='/opt/oracle/oradata/prd/onlinelog/','/opt/oracle/clone'
*.diagnostic_dest='/opt/oracle/app'

Start the instance in the nomount stage

$ export ORACLE_SID=clone
$sqlplus / as sysdba

sql> startup nomount

sql> exit

Make sure you have configured the Listener.ora with the STATIC registration of the Cloned instance.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = clone)
(ORACLE_HOME = /opt/oracle/app/11.2.0.3)
(SID_NAME = clone)
)
)

Reload the Listener and verify the registration

$ lsnrctl reload

Configure the TNSNAMES connectivity for both the sides of source and destination server.

$ tnsping clone ----- from the source and destination
$ tnsping prod ----- from the source and destination

Connect to RMAN and start the duplication process.
Note: Iam using target control file instead of a recovery catalog

#rman target sys/orcl@prod
RMAN> connect auxiliary sys/orcl@clone

RMAN> DUPLICATE TARGET DATABASE TO 'clone' FROM ACTIVE DATABASE;

At some poing the duplication fails with the below error

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 01/30/2008 17:12:42
RMAN-05501: aborting duplication of target database
RMAN-05001: auxiliary file name /u01/oradata/prod/redo03.log conflicts with a file used by the target database
RMAN-05001: auxiliary file name /u01/oradata/prod/redo02.log conflicts with a file used by the target database
RMAN-05001: auxiliary file name /u01/oradata/prod/redo01.log conflicts with a file used by the target database

My source database is using the OMF files. So you cant able to use db_file_name_convert and log_file_name_convert parameter to clone the database when there source database files are Oracle Managed Files.

Quoting the official documentation:

If the source database files are in the Oracle Managed Files (OMF) format, then you cannot use the DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT initialization parameters or the fileNameConversionSpec clause to generate new OMF filenames for the duplicate database. OMF filenames are unique and generated by Oracle Database.

The only exception to this rule is when changing only an ASM disk group name. Assume that source datafiles and online redo log files are stored in ASM disk group +SOURCEDSK. You want to store the duplicate database files in ASM disk group +DUPDSK. In this case, you can set the initialization parameters as follows:

DB_FILE_NAME_CONVERT = (“+SOURCEDSK”,”+DUPDSK”)
LOG_FILE_NAME_CONVERT = (“+SOURCEDSK”,”+DUPDSK”)
RMAN uses DB_FILE_NAME_CONVERT or LOG_FILE_NAME_CONVERT to convert the disk group name, and then generates a new, valid filename based on the converted disk group name.

You have the following other supported options for naming datafiles when the source files are in the Oracle Managed Files format:

Use SET NEWNAME to specify names for individual datafiles.

Set DB_FILE_CREATE_DEST to make all datafiles of the new database Oracle-managed files, with the exception of the files for which SET NEWNAME is used. You should not set DB_FILE_NAME_CONVERT if you set DB_FILE_CREATE_DEST.

Supported options for naming online redo logs duplicated from Oracle-managed files are DB_CREATE_FILE_DEST, DB_RECOVERY_FILE_DEST, or DB_CREATE_ONLINE_LOG_DEST_n.

So shutdown the cloned instance and make sure you have removed the DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT parameterb from the pfile and set the DB_FILE_CREATE_DEST parameter ,
start the database in the nomount stage and proceed with the RMAN duplicate database creation

RMAN> connect auxiliary sys/orcl@clone

RMAN> DUPLICATE TARGET DATABASE TO 'clone' FROM ACTIVE DATABASE;

contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 28-FEB-14