Creating Duplicate Database from Rman Using the Backups done at OS level

posted Mar 16, 2011, 12:43 PM by Sachchida Ojha
Creating Duplicate database from Rman using the backups that are done at OS level .

The backup that is used in the  example is a cold backup of the database

Below the procedure with an example:

Assumed database names:

Primary Database SID: PROD
Duplicate Database SID: AUX
Rman Catalog SID: RMAN

1) Perform a cold backup of the primary database

- SQL> Shutdown immediate;

[oracle@test-br data]$ cp /home/oracle/PROD/data/sys01.dbf /home/oracle/PROD/data/backup/sys01.dbf
[oracle@test-br data]$ cp /home/oracle/PROD/data/undotbs.dbf /home/oracle/PROD/data/backup/undotbs.dbf
[oracle@test-br data]$ cp /home/oracle/PROD/data/users_9i.dbf /home/oracle/PROD/data/backup/users_9i.dbf
[oracle@test-br data]$ cp /home/oracle/PROD/data/test01.dbf /home/oracle/PROD/data/backup/test01.dbf


2) Connect to target database and recovery catalog from rman
% Rman target / catalog rman/rman@con_catalog

3) Startup the database
RMAN> startup

4) Catalog the datafile copies
RMAN>catalog datafilecopy '/home/oracle/PROD/data/backup/sys01.dbf';

cataloged datafile copy
datafile copy filename=/home/oracle/PROD/data/backup/sys01.dbf recid=9 stamp=617219529

RMAN> catalog datafilecopy '/home/oracle/PROD/data/backup/undotbs.dbf';

cataloged datafile copy
datafile copy filename=/home/oracle/PROD/data/backup/undotbs.dbf recid=10 stamp=617219556

RMAN> catalog datafilecopy '/home/oracle/PROD/data/backup/users_9i.dbf';

cataloged datafile copy
datafile copy filename=/home/oracle/PROD/data/backup/users_9i.dbf recid=11 stamp=617219574

RMAN> catalog datafilecopy '/home/oracle/PROD/data/backup/test01.dbf';

cataloged datafile copy
datafile copy filename=/home/oracle/PROD/data/backup/test01.dbf recid=12 stamp=617219589

5) Now create a pfile for the duplicate instance

# +----------------------------------------+
# | FILE : initAUX.ora |
# | DATABASE NAME : AUX |
# +----------------------------------------+
# Set the below to location of the clone Duplicate database / name of
# clone database.

audit_file_dest =/oradata/aux/adump
background_dump_dest =/oradata/aux/bdump
core_dump_dest =/oradata/aux/cdump
user_dump_dest =/oradata/aux/udump
db_name ="AUX"
instance_name =AUX

# Set the below to the location of the duplicate clone control file.

control_files ='/home/oracle/aux/c1.ctl'


# Set the below for the from and to location for all data files / redo
# logs to be cloned.

log_file_name_convert=('/home/oracle/PROD/redo/','/home/oracle/aux/')
db_file_name_convert=('/home/oracle/PROD/data/','/home/oracle/aux/')

#Set the below to the same as the production target

undo_management =AUTO
undo_retention =10800
undo_tablespace =UNDOTBS1
db_block_size = < >
compatible = 9.2.0
6) Startup nomount the auxiliary database

$ export ORACLE_SID=aux1
$ sqlplus "/as sysdba"
SQL> Startup nomount

7) Now connect to target,catalog and auxiliary instances from Rman

$ rman target sys/sys@con_tar catalog rman/rman@con_cat auxiliary /

Recovery Manager: Release 9.2.0.7.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

connected to target database: PROD (DBID=4282295901)
connected to recovery catalog database
connected to auxiliary database: aux1 (not mounted)

8) Perform a log switch

RMAN> sql 'alter system switch logfile';

sql statement: alter system switch logfile

9) Perform the duplicate

+ RMAN> duplicate target database to aux1;
Comments