CREATING DUPLICATE DATABASE FROM RMAN USING THE BACKUPS DONE AT OS LEVEL DOC ID 419144.1

CREATING DUPLICATE DATABASE FROM RMAN USING THE BACKUPS DONE AT OS LEVEL DOC ID 419144.1

Oracle Database - Enterprise Edition - Version 9.2.0.1 and later

Oracle Database Cloud Schema Service - Version N/A and later

Oracle Database Exadata Express Cloud Service - Version N/A and later

Oracle Database Exadata Cloud Machine - Version N/A and later

Oracle Cloud Infrastructure - Database Service - Version N/A and later

Information in this document applies to any platform.


GOAL

This note explains creation of 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

SOLUTION

  

NOTE: In the images and/or the document content below, the user information and environment data used represents fictitious data from the Oracle sample schema(s), Public Documentation delivered with an Oracle database product or other training material. Any similarity to actual environments, actual persons, living or dead, is purely coincidental and not intended in any manner.  

For the purposes of this document, the following fictitious environment is used as an example to describe the procedure:

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/@

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/@ auxiliary / catalog rman/@  

 

 

 

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;

Please note:  In 11gr2 there is an option to create RMAN duplicate without connecting to target and catalog with a BACKUP LOCATION pointing to disk backup.  

You can explore using this option in 11gr2 which is applicable even for datafile copy

RMAN 11GR2 : DUPLICATE Without Target And Recovery Catalog Connection Note 874352.1