Professional Documents
Culture Documents
RMAN Clone v1.0
RMAN Clone v1.0
RMAN Clone v1.0
Auth
Document Control
Documents Followed
3
4
Reviewers
Name Position
Notation Meaning
SOURCE PRODUCTION (WPROD)
TARGET Instance which has to be cloned (Duplicated) TPROD
PREPARATION
1 Get the list of datafile 1.Login to PROD and get the list of datafiles from v$datafile as
from the instance which follows:
is used as a PROD for set head off
cloning set pages 0
select 'set newname for datafile '||file#||' to ' ||''''||name||''''||';'
from v$datafile;
select 'set newname for tempfile '||FILE#||' to ' ||''''||name||''''||';'
from v$tempfile;
3. Edit the spool file with the target datafile location paths
4a Use the attached script 1.Once edited append other lines in the file (clone_target.rman)
as reference taking attached script as reference
rman.cmd
run
{
allocate AUXILIARY CHANNEL c1 type 'SBT_TAPE';
allocate AUXILIARY CHANNEL c2 type 'SBT_TAPE';
allocate AUXILIARY CHANNEL c3 type 'SBT_TAPE';
allocate AUXILIARY CHANNEL c4 type 'SBT_TAPE';
SEND 'NB_ORA_CLIENT=sjdbpr584a.corp.webex.com';
set newname for datafile 1 to '/data01/oradata/TPROD/system01.dbf';
set newname for datafile 2 to '/data01/oradata/TPROD/system02.dbf';
set newname for datafile 3 to '/data01/oradata/TPROD/system03.dbf';
set newname for datafile 4 to '/data01/oradata/TPROD/sysaux01.dbf';
set newname for datafile 5 to '/data01/oradata/TPROD/undotbs101.dbf';
set newname for datafile 6 to '/data01/oradata/TPROD/xxhyp1x01.dbf';
set newname for datafile 7 to '/data01/oradata/TPROD/xxhyprptx01.dbf';
set newname for datafile 8 to '/data01/oradata/TPROD/xxhypsysx01.dbf';
set newname for datafile 9 to '/data01/oradata/TPROD/ctxd01.dbf';
set newname for datafile 10 to '/data01/oradata/TPROD/jld01.dbf';
set newname for datafile 11 to '/data01/oradata/TPROD/ieud01.dbf';
set newname for datafile 12 to '/data01/oradata/TPROD/gmld01.dbf';
set newname for datafile 13 to '/data01/oradata/TPROD/xtrd01.dbf';
set newname for datafile 14 to '/data01/oradata/TPROD/mstx01.dbf';
set newname for datafile 15 to '/data01/oradata/TPROD/jlx01.dbf';
set newname for datafile 16 to '/data01/oradata/TPROD/igfd01.dbf';
set newname for datafile 17 to '/data01/oradata/TPROD/clr_idx01.dbf';
set newname for datafile 18 to '/data01/oradata/TPROD/jtmd01.dbf';
set newname for datafile 19 to '/data01/oradata/TPROD/amvd01.dbf';
set newname for datafile 20 to '/data01/oradata/TPROD/amvx01.dbf';
set newname for datafile 21 to '/data01/oradata/TPROD/oked01.dbf';
set newname for datafile 22 to '/data01/oradata/TPROD/msdd01.dbf';
set newname for datafile 23 to '/data01/oradata/TPROD/igix01.dbf';
set newname for datafile 24 to '/data01/oradata/TPROD/fvx01.dbf';
set newname for datafile 25 to '/data01/oradata/TPROD/drsys01.dbf';
set newname for datafile 26 to '/data01/oradata/TPROD/cctx01.dbf';
set newname for datafile 27 to '/data01/oradata/TPROD/asgd01.dbf';
set newname for datafile 28 to '/data01/oradata/TPROD/ahld01.dbf';
set newname for datafile 29 to '/data01/oradata/TPROD/ieux01.dbf';
set newname for datafile 30 to '/data01/oradata/TPROD/gmsx01.dbf';
set newname for datafile 31 to '/data01/oradata/TPROD/cspx01.dbf';
set newname for datafile 32 to '/data01/oradata/TPROD/lnsx01.dbf';
set newname for datafile 33 to '/data01/oradata/TPROD/iemd01.dbf';
……………………………etc. (the lines in blue italics are obtained from the query in step
2)
set until sequence xxxx thread yyyy;
where xxxx is the sequence number and yyyy is the tread number and xxxxxx ,yyyy are
determined from step 4b or 4c as required.
duplicate target database to "TPROD"
LOGFILE
GROUP 1 (
'/data01/oradata/TPROD/redo1a.log',
'/data02/oradata/TPROD/redo1b.log'
) SIZE 512M,
GROUP 2 (
'/data01/oradata/TPROD/redo2a.log',
'/data02/oradata/TPROD/redo2b.log'
) SIZE 512M,
GROUP 3 (
'/data01/oradata/TPROD/redo3a.log',
'/data02/oradata/TPROD/redo3b.log'
) SIZE 512M;
}
Note:
In the above rman.cmd script mention the below command as per the
source server. If we are doing cloning from WPROD to test server the
below parameter should be
Eg:
SEND 'NB_ORA_CLIENT=sjdbpr584a.corp.webex.com';
4b Resotring the database to 1.Determine the point upto which media recovery should run on the
the point of rman backup restored database.
completion.
RMAN> list backup of archivelog all ;
Check the last archive sequence for all redo threads and select the
archive sequence having LEAST "Next SCN" among them. In our
case sequence 58 of thread 1 has Next SCN of 233107 while
sequence 3 of thread 2 has Next SCN of 233110. Since squence 58
of thread 1 has least Next SCN we will recover upto this point. (If you
are keen to have recovery run until some specific time you can always
give SET UNTIL TIME)
4c Find the SCN or Time to 1.Take the archive log RAM backup.
recover upto certain time
after RMAN backup Once archival backup completes
completes
2.Determine the point upto which media recovery should run on the
restored database.
RMAN> list backup of archivelog all;
Check the last archive sequence for all redo threads and select the
archive sequence having LEAST "Next SCN" among them. In our
case sequence 58 of thread 1 has Next SCN of 233107 while
sequence 3 of thread 2 has Next SCN of 233110. Since squence 58
of thread 1 has least Next SCN we will recover upto this point. (If you
are keen to have recovery run until some specific time you can always
give SET UNTIL TIME)
3.Once the restore is done check the status of the database and
restore logfile for error.
b Check the status of 1. Run:
database select count(*) from v$recover_file;
2.Run:
select distinct(status) from v$datafile;
select count(*) from dba_data_files; ----To compare with
production.
TO make sure all the files are online and there are no files that
need recovery
9 Perform a sanity check of 1.perform a sanity check of the database (check if there are any
the database ORA- errors)
10 Disabling archive log By default rman puts the database in archive log mode
So perform the below steps to put it in noarchivelog (Should be
only if target is run in noarchive log mode)
Sql>shutdown immediate;
Sql>startup mount
Sql>alter database noarchivelog
Sql>alter database open