Cloning database with RMAN

Cloning database with RMAN

Clone Oracle Database :- Many time we need to create a clone of Production Database. Below are the situation where we need to create clone of Production Database

1) To setup UAT/Test Environment
2) To refresh the UAT/Test Environment
3) To Prepare DR server
4) To setup Data-Gaurd Environment

Prerequisites :-Below are the prerequisites for creating clone on UAT/Test server.

1) OS and Version of OS should be same as Production server
2) Database software Version should be same as Production server

3) Servers should be reachable from each-other  

Below are the steps to create the clone of Production Database on Destination/UAT/Test Server.


On Production Server :-


STEP1:- Take full database backup and control file backup in primary database using RMAN.

RMAN>backup database plus archivelog;
RMAN>backup current controlfile;

STEP2:- Create PFILE from SPFILE
SQL>create pfile from spfile; 

STEP3:- Open pfile and make following changes:
a) Change primary database name with clone database name
b) Add "db_file_name_convert" and "log_file_name_convert" parameters to pfile



On Test/UAT Server :-

STEP4:- Create same directory structure in clone database server and copy RMAN backup pieces and pfile from primary database server to clone database server.

STEP5:- Create all required directories in cloned server mentioned in pfile


STEP6:- Create clonedb entry in /etc/oratab file.


STEP7:- Set oracle environment to "clonedb" in .bash_profile


cat>>/home/oracle/.bash_profile<
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome
export ORACLE_SID=clonedb
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin
EOF

STEP8:- Login to sqlplus and start up the database with nomount.This will start an auxiliary instance for clonedb database.
 

$sqlplus sys as sysdba
SQL>startup nomount;

STEP9:- Connect RMAN in cloned server and follow below steps
$rman
RMAN> connect auxiliary /
RMAN> connect target sys/sys@primdb
RMAN> run
2> {
3> allocate auxiliary channel c1 device type disk;
4> allocate channel c2 device type disk;
5> duplicate target database to 'clonedb';
6> }

No comments:

Post a Comment