Tuesday, March 7, 2023

RMAN based Database Duplicate

Scenerio: We would like to restore a database to new server with different name from the backup with until time clause. Steps in Brief: 1. Start the Target database instance (RMAN Auxiliary) at nomount as single node; configure the controfile to file system or ASM diskgroup with just name, instead of complete path, like '+DATA1','+DATA2','+FRA' 2. Configure static listener and start it, start the above database with local_listener parameter. 3. run the rman command and connect source (RMAN target) using SYS and connect target (RMAN Auxiliary) database using / 4. Since we restoring from backup device, make sure the backup medium is accessible from target database $ export ORACLE_SID=TARGET_INSTANCE $ rman RMAN> connect target sys/<>@ RMAN> connnect auxiliary / RMAN>run{ allocate channel A1 device type disk; allocate channel A2 device type disk; allocate channel A3 device type disk; allocate channel A4 device type disk; Allocate auxiliary channel c1 type 'sbt_tape' PARMS="SBT_LIBRARY=/opt/commvault/Base/libobk.so,BLKSIZE=1048576"; Allocate auxiliary channel c2 type 'sbt_tape' PARMS="SBT_LIBRARY=/opt/commvault/Base/libobk.so,BLKSIZE=1048576"; Allocate auxiliary channel c3 type 'sbt_tape' PARMS="SBT_LIBRARY=/opt/commvault/Base/libobk.so,BLKSIZE=1048576"; Allocate auxiliary channel c4 type 'sbt_tape' PARMS="SBT_LIBRARY=/opt/commvault/Base/libobk.so,BLKSIZE=1048576"; DUPLICATE TARGET DATABASE TO TARGET_DB_NAME until time "to_date('07-MAR-23 09.02.51PM','dd-mon-yy hh:mi:sspm')" ; } After Database is OPEN. Configure the database in srvctl srvctl add database -db TARGET_DB_NAME -oraclehome /u01/app/oracle/product/12.2.0/dbhome_1 srvctl add instance -db TARGET_DB_NAME -instance TARGET_instance_NAME1 -node hostname1 srvctl add instance -db TARGET_DB_NAME -instance TARGET_instance_NAME2 -node hostname2 srvctl add instance -db TARGET_DB_NAME -instance TARGET_instance_NAME3 -node hostname3