I have installed two virtual machine on my PC (Red Hat 6) ,and installed oracle (11.2.0) binary both machine and created database on one machine name DB11G, Now I want to duplicate DB11G database as DB11G2 to my 2nd machine .
Step 1: I have created database backup using RMAN on DB11G database ,
rman target=/
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
Step 2: Login to 2nd machine and created the oracle password file in dbs folder
orapwd file=/u01/app/oracle/product/11.2.0/db_1/dbs/orapwDB11G2 password=password entries=10
Step 3:Also added to tns entry in "tnsnames.ora" file in the
"$ORACLE_HOME/network/admin" directory
DB11G=(DESCRIPTION =
(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST =1stMachine-IP )(PORT = 1521))
)
(CONNECT_DATA =(ORACLE_SID = DB11G)
)
)
Step 4: Also created the PFILE on 2nd machine "initDB11G2.ora"
DB_NAME=DB11G2
# Convert file names to allow for different directory structure if necessary.
#DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/DB11G/','/u01/app/oracle/oradata/DB11G2/'
#LOG_FILE_NAME_CONVERT='/u01/app/oracle/oradata/DB11G/','/u02/app/oracle/oradata/DB11G2/'
Step 5: Create any directories necessary for start the duplicate database.
mkdir -p /u01/app/oracle/oradata/DB11G
mkdir -p /u01/app/oracle/fast_recovery_area/DB11G
mkdir -p /u01/app/oracle/admin/DB11G/adump
Step 6: Copy all the backup files from 1st machine to 2nd machine.
scp -r /u01/app/oracle/fast_recovery_area/DB11G/archivelog oracle@2ndMachine-IP:/u01/app/oracle/fast_recovery_area/DB11G
scp -r /u01/app/oracle/fast_recovery_area/DB11G/backupset
oracle@2ndMachine-IP:/u01/app/oracle/fast_recovery_area/DB11G
scp -r /u01/app/oracle/fast_recovery_area/DB11G/autobackup
oracle@2ndMachine-IP:/u01/app/oracle/fast_recovery_area/DB11G
Setp 7:Log in to 2nd machine
export ORACLE_SID=DB11G2
#this is which you have installed oracle version
*.compatible='11.2.0.4.0'
sqlplus / as sysdba
SQL> startup nomount
SQL> exit
Step 8:Login RMAN as auxiliary database
rman auxiliary /
RMAN>
Step 9: Enter duplicate command as bellow
RMAN>DUPLICATE DATABASE DB11G TO DB11G2 BACKUP LOCATION '/u01/app/oracle/fast_recovery_area/DB11G' nofilenamecheck;