RMAN Duplicate from Active Database
Clone databases directly with RMAN Active Duplication.
STEP 1: Must source db in archive log mode
STEP 2: Configure Listener on both servers orcl and clone
Start the listener on orcl server
lsnrctl start listener
Start the listener on clone server
lsnrctl start listener
STEP 3: Configure tns entries on the both servers source and clone servers
STEP 4: Make sure to test the tnsping is working from prod to clone server
STEP 5: On orcl server, create pfile from spfile and copy to clone server
scp initorcl.ora [email protected]:/u01/app/oracle/product/19c/dbhome_1/dbs/initclone.ora
STEP 6: Also copy the password file from prod to clone server
If no password file exists, create one via below command and then copy
orapwd file=$ORACLE_HOME/dbs/orapwclone force=y
password for sys: orcldb$123
STEP 7: On the clone server, open the pfile that you copied from orcl server. Replace orcl with clone
SID
vi $ORACLE_HOME/dbs/initclone.ora
:%s/orcl/clone --> replace orcl with clone
Add below two parameters to change data files and log files locations while cloning database
*.db_file_name_convert='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/clone'
*.log_file_name_convert='/u01/app/oracle/oradata/orcl','/oradb/app/oracle/oradata/clone'
STEP 8: Create respective directories from the clone pfile. In my case, I had to create below
directories
mkdir -p /u01/app/oracle/admin/clone/adump
mkdir -p /u01/app/oracle/oradata/CLONE/controlfile/
mkdir -p /u01/app/oracle/fast_recovery_area
Also create data files and redo log files locations from source on clone server
mkdir -p /u01/app/oracle/oradata/CLONE/datafile/
mkdir -p /u01/app/oracle/oradata/CLONE/onlinelog/
STEP 9: Take clone server database to nomount stage
STEP 10:
RMAN Active Duplication:
NOFILENAMECHECK: If you want the duplicate filenames to be the same as the target filenames, and if
the databases are in different hosts, then you must specify NOFILENAMECHECK
db_file_name_convert: This parameter specifies from where to where the datafiles should be cloned.
log_file_name_convert:This parameter specifies from where to where the redo logfiles should be cloned
Connect as auxiliary database to create a new database in TARGET location
STEP 11:
STEP 12: Verify the status of TARGET database status
WE SUCCESSFULLY CLONE THE DB