RMAN duplicate command for refresh the QA server

Scripts for duplicating the database from PROD to QA with RMAN

Duplicate command is used for refresh activity in RMAN , It will create replica of Prod environment with single command. It’s very useful when their is regular demand of refresh activity occurred.

Note: you can used it in linux also by changing extension bat to shell.
For Configure RMAN command on Window Server, Create following two file one as bat and other as text file.

Step 1: Create a bat file for RMAN duplicate command

create dup.bat file

@echo off
set Stamp=%DATE:~-4%%DATE:~-10,2%%DATE:~-7,2%
rman catalog rman/rman@rman target / auxiliary system/password@QA cmdfile dup.rcv log dup_%Stamp%.log

Step 2: Create new file which having command for duplicate the database

create a new textfile and name it “dup.rcv” file

run {
#Allocate the channel for the duplicate work
set until time "to_date('Oct 06 2012 05:20:00','Mon DD YYYY HH24:MI:SS')";
Allocate auxiliary channel ch1 TYPE 'SBT_TAPE';
#Using TAPE then "SEND" cmd, otherwise mentioned "DISK" instead of "SBT_TAPE"
#set the new file names and locations for all datafiles
set newname for datafile 1 to 'G:\ORADATA\QA\SYSTEM01.DBF';
set newname for datafile 2 to 'G:\ORADATA\QA\UNDOTBS01.DBF';
set newname for datafile 3 to 'G:\ORADATA\QA\SYSAUX01.DBF';
set newname for tempfile 1 to 'G:\ORADATA\QA\TEMP01.DBF';
set newname for tempfile 2 to 'G:\ORADATA\QA\TEMP02.DBF';
#Duplicate the database to QA
GROUP 1 ('G:\oradata\QA\REDO01.LOG') SIZE 100M,
GROUP 2 ('G:\oradata\QA\REDO02.LOG') SIZE 100M,
GROUP 3 ('G:\oradata\QA\REDO03.LOG') SIZE 100M;}



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s