Oracle 11g 10g RMAN Duplicate Database Command Using TAG: How to Clone a Database in same server / node

_____________________________________________________________________________________________________________________

The Eucharistic Miracles of the World
In this scenario our source database is prod9 and destination database Test9. i.e. Target is PROD9, Auxiliary (database to be cloned) is TEST9 and TAG is PROD_DB.
Please see the steps to perform the database cloning.

Step 1
Connect to target database using RMAN and find out the tag details for the particular tag. Note down the SCN details for the tag

$ export ORACLE_SID=PROD9
$ rman target /

Recovery Manager: Release 11.2.0.2.0 - Production on Tue Nov 8 00:47:35 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PROD9 (DBID=2126123454)

RMAN> list backup tag PROD_DB;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
255     Full    18.08M     DISK        00:00:00     17-OCT-11
        BP Key: 255   Status: AVAILABLE  Compressed: NO  Tag: PROD_DB
        Piece Name: +PROD9_FILES/PROD9/backups/PROD9_cf_c-2126123454-20111017-02
        Keep: BACKUP_LOGS        Until: FOREVER
  SPFILE Included: Modification time: 17-OCT-11
  SPFILE db_unique_name: PROD9
  Control File Included: Ckp SCN: 135393380    Ckp time: 17-OCT-11

Step 2

Create or modify existing parameter file for Auxiliary database with following additional parameters. Here the file name is inittest9_clone.ora

DB_FILE_NAME_CONVERT=('+PROD9_DATA/PROD9/datafile/','+TEST9_DATA/TEST9/datafile/')
DB_FILE_NAME_CONVERT=('+PROD9_DATA/PROD9/tempfile/','+TEST9_DATA/TEST9/tempfile/')
LOG_FILE_NAME_CONVERT=('+PROD9_FILES/PROD9/onlinelog/','+TEST9_FILES/TEST9/onlinelog/')
If your Auxiliary database is running of Cluster add the following parameter

cluster_database=false
If your Auxiliary database is running on 11.2.0 then add the folling parameter
compression_compatibility='11.2.0.0.0'

Step 3

Add TNS entries to TARGET and RMAN catalog database from the Auxiliary database ORACLE_HOME and make sure the connectivity is working fine.

Step 4
Shutdown the Auxiliary database – TEST9
$ export ORACLE_SID=TEST9
For RAC:
srvctl stop database –d TEST9
For Normal database
Sqlplus “/ as sysdba”
Shutdown immediate;

Step 5
Start the Auxiliary database(TEST9) instance with nomount option using the new parameter file
$ sqlplus "/ as sysdba"

SQL*Plus: Release 11.2.0.2.0 Production on Tue Nov 8 00:54:55 2011

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount pfile='/u01/app/oracle/product/11.2.0/dbhome/dbs/inittest9_clone.ora.clone’;
ORACLE instance started.

Total System Global Area 3206836224 bytes
Fixed Size                  2230768 bytes
Variable Size            2214594064 bytes
Database Buffers          838860800 bytes
Redo Buffers              151150592 bytes

Step 6
Connect to RMAN Target as PROD9, RMAN catalog and Auxiliary as TEST9
$ rman target rmanbkup/rman965@PROD9 catalog rman/rman@rmancat auxiliary /

Recovery Manager: Release 11.2.0.2.0 - Production on Tue Nov 8 00:57:26 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PROD9 (DBID=2126123454)
connected to recovery catalog database
connected to auxiliary database: TEST9 (not mounted)

Step 7
Issue the DUPLICATE DATABASE comman on the RMAN prompt using UNTIL SCN and mention the SCN number which we got from the tag in Step#1.
RMAN> duplicate target database to TEST9 until scn 135393380;

Starting Duplicate Db at 08-NOV-11
configuration for DISK channel 2 is ignored
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=652 device type=DISK
.. .. ..
.. .. ..
.. .. ..
.. .. ..


executing Memory Script

database opened
Finished Duplicate Db at 08-NOV-11

_____________________________________________________________________________________________________________________

0 comments:

Post a comment

 

acehints.com Copyright 2011-20 All Rights Reserved | Site Map | Contact | Disclaimer