Duplicate Database

Differnce Scenarios :

Clone database   
with RMAN backup    
and connecting to prod/target   
using duplicate target database to DUP
11gR2 Clone database 
with RMAN backup    
without connecting to prod/target
using duplicate target database to DUP backup location '/backup'
Clone database        
with RMAN backup
without connecting to prod/target
Manual restore 
Clone database        
with ACTIVE  RMAN backup
and connecting to prod/target   
using duplicate target database to DUP from active database







Duplicate Database with RMAN backup  by connecting to Target database


Production:> backup full database format '/u01/app/oracle/backup/%d_%U.bkp' plus archivelog format '/u01/app/oracle/backup/%d_%U.bkp';

Restore backup from production(target database) to '/u01/app/oracle/backup' on clone server

create pfile and password file for clonedb. For ASM, just have file_create_dest and log_create_dest and control_files='DATA1'

starup instance clonedb in nomount using spfile

Note : Check if ther are incarnations. Ensure there are no old archive logs in FRA path. Duplicate automatically catalog the archived logs  and then result in incarnation error.


rman  target sys/oracle@prod   auxiliary / 

RMAN> duplicate target database to dbdemo nofilenamecheck;





11gr2  : Duplicate Database with RMAN backup  without  connecting  to Target database or Catalog 

Restore backup from production(target database) to '/u01/app/oracle/backup' on clone server

create pfile for clonedb and / or password file.create pfile and password file for clonedb. For ASM, just have file_create_dest and log_create_dest and control_files='DATA1'

starup instance clonedb in nomount using spfile.

set ORACLE_SID and ORACLE_HOME for clonedb


$ rman  auxiliary /

RMAN> duplicate database to clonedb backup location '/u01/app/oracle/backup' nofilenamecheck;



Duplicate Database with RMAN backup  without  connecting  to Target database or Catalog and without duplicate command

Change init.ora entries as required

instance_name = ???
db_name=ora10g
control_files
db_file_name_convert , log_file_name_convert  or
DB_CREATE_FILE_DEST and DB_CREATE_ONLINE_DEST_n

export ORACLE_SID=ora10g
$ rman target /
RMAN> startup nomount
RMAN> restore controlfile from '/new_backuplocation/c-3932056136-20070213-02';

RMAN> alter database mount ;
RMAN> catalog backuppiece /new_backuplocation/o1_DB_TAG20070213T002925.bkp'
RMAN > list backup of archivelog all;
   From all the threads, select the sequence x with the highest values and take the seq which is having Lowest Scn. ensure this last archived log is not backed up twice in production.

SQL> alter database rename file '/u01/oracle/product/oradata/ora10g/log/redo01.log' to '/home/oracle/test/log/redo01.log';
RMAN>

run { set until sequence <seq_no x +1 >
set newname for datafile 1 to '/home/oracle/test/data/sys01.dbf';
set newname for datafile 2 to '/home/oracle/test/data/undotbs01.dbf';
restore database;
switch datafile all;
recover database;
alter database open resetlogs; }



Create listener.ora entry for the duplicate database

Create tnsnames alias entries for production database and duplicate database.


Create the password file  : $ orapwd file=$ORACLE_HOME/dbs/orapwDUP password=***** entries=10



Duplicate Database without RMAN backup by connecting to Target database or Catalog

Change init.ora entries as required

instance_name = DUP
control_files
db_file_name_convert , log_file_name_convert  or
DB_CREATE_FILE_DEST and DB_CREATE_ONLINE_DEST_n


Create listener.ora entry for the duplicate database

Create tnsnames alias entries for production database and duplicate database.

Create the password file  : $ orapwd file=$ORACLE_HOME/dbs/orapwDUP password=***** entries=10

Startup nomount

rman target sys/****@prod auxiliary sys/*****@dup


duplicate target database to DUP from active database;