Rman duplicate database - quick notes.

Quick notes on duplicating database following level 0 rman backup.

Wanted a duplicate of a db called MPROD to one called MPRODX.

So ran the rman backup and copied the backup to another server.

Started the mprodx database with a "skeleton" pfile - the db name option should suffice.

Most of the parameters are optional.

 
SQL> startup nomount pfile=/u01/app/oracle/product/12.2.0/dbhome_1/dbs/initmprodx.ora
ORACLE instance started.
 
Total System Global Area 1.6106E+10 bytes
Fixed Size                  4516272 bytes
Variable Size            2281702992 bytes
Database Buffers         1.3791E+10 bytes
Redo Buffers               29036544 bytes

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.2.0 - 64bit Production
 
Created a script to do the duplicate (the rman backup was encrypted but not a common thing to do, so ignore the decryption option). 

Created the script dupl,txt
 
set echo on;
-- set decryption identified by 'password123' ;
run {
 
allocate auxiliary channel d1  type disk ;
allocate auxiliary channel d2  type disk ;
allocate auxiliary channel d3  type disk ;
allocate auxiliary channel d4  type disk ;
 
duplicate database to MPRODX  backup location '/backup/rman_back';
 
release channel d1 ;
release channel d2 ;
release channel d3 ;
release channel d4 ;
 
}
  
Run the script in the background (change /home/oracle to wherever).

nohup rman auxiliary / cmdfile=/home/oracle/dupl.txt log=/home/oracle/refresh_mprodx.log &

At the end of this should have a duplicate database. You might hit an issue if with files already existing but if you are totally certain that you are not overwriting an existing database you can use the nofilenamecheck option to stop this. Check the log file to confirm ok.

 

No comments:

Post a Comment