Duplicating the DB from PRODUCTION to DEVELOPMENT using RMAN

The topic is related to creating a duplicated copy of  DB from production  to Development  using rman.
The below steps are applicapable in 9i,10g and 11g.In 11g there are some new methods for creating duplicate DB  which I will be covering  in coming topics

The database names used here

database names:

Primary Database SID:       PROD  server RAC1
Duplicate Database SID:     DEVEL server RAC2

Steps involed 
1.  Backup the primary database.

2.  Determine how much disk space will be required.

3.  Ensuring you have enough space on your target server.

4.  Making the backup available for the duplicate process.

5.  Creating the init.ora & administration directories for the duplicate database.

6.  Ensuring SQL*NET connections to primary database and RMAN catalog are working.

7.  Execute the RMAN script

1. Backup the primary database
Before creating a duplicate database, we must create a backup of the production DB including archivelogs also.Here i have used backup media as disk  and i am not using a recovery catalog DB

connect to the target database and take a fresh  backup

[oracle@RAC1 backup]$ export ORACLE_SID=PROD
[oracle@RAC1 backup]$ rman target /

RMAN> run
2> {
3> allocate channel d1 type disk;
4> allocate channel d2 type disk;
5> backup format ‘/oracle/backup/df_prodt%t_s%s_p%p.bak’ database;
6> sql ‘alter system archive log current’;
7> backup format ‘/oracle/backup/df_archive%t_s%s_p%p.arc’ archivelog all
8> release channel d1;
9>  release channel d2;
10> }

2.  Ensure enough space is available on the target server for Db and backup pieces

3.  Ensuring you have enough space on your target server.

4.  Making the backup available for the duplicate process.
     copy  the database from source server to target server

5.Creating the pfile  file  for the duplicate database

create a pfile and add the below contents  and start the DB in nomount mode

[oracle@RAC2 dbs]$ cat initDEVEL.ora
audit_file_dest =/oracle/DEVEL/adump
background_dump_dest =/oracle/DEVEL/bdump
core_dump_dest =/oracle/DEVEL/cdump
user_dump_dest =/oracle/DEVEL/udump
db_name =”DEVEL”
instance_name =DEVEL
control_files =(‘/oracle/DEVEL/control01.ctl’)

db_file_name_convert =(“/oracle/PROD/”, “/oracle/DEVEL/”)
log_file_name_convert =(“/oracle/PROD/”, “/oracle/DEVEL/”)

undo_management =AUTO
undo_retention =10800
undo_tablespace =UNDOTBS1
db_block_size = 8192
compatible = 10.2.0.1.0

[oracle@RAC2 dbs]$ export ORACLE_SID=DEVEL
[oracle@RAC2 dbs]$ sqlplus ‘/ as sysdba’

SQL*Plus: Release 10.2.0.1.0 – Production on Sat Feb 18 21:01:50 2006

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

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area  113246208 bytes
Fixed Size                  1218004 bytes
Variable Size              58722860 bytes
Database Buffers           50331648 bytes
Redo Buffers                2973696 bytes

SQL> exit

6.  Ensuring SQL*NET connections to primary database and RMAN catalog are working.

  Add  the conection descriptors in the tnsnames.ora and check the connectivity

7.  Execute the RMAN script
[oracle@RAC2 backup]$ rman target sys/oracle@prod

Recovery Manager: Release 10.2.0.1.0 – Production on Sat Feb 18 21:28:31 2006

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

connected to target database: PROD (DBID=4289561465)

RMAN> connect auxiliary /

connected to auxiliary database: DEVEL (not mounted)
RMAN> run
2> {
3> allocate auxiliary channel C1 device type disk;
4> allocate auxiliary channel C2 device type disk;
5> duplicate target database to DEVEL;
6> release channel C1;
7> release channel C2;
8> }

The above script will do the duplication and it will open up the development database.

Please let me know if you have some doubts or issues.
 

About the Author Masroof Ahmad

Leave a Comment: