Cloning / duplicating with RMAN, the basics

It is considered  a skill every DBA should have, cloning a database with RMAN.  But still meeting DBA’s which never used this… Decided to write down some basic RMAN-stuff , just as a notepad, and maybe it’s helpfull for others..

My own basic checklist through an example:

Cloning of the  DEVDB on the node  LARRIE to node ELLISON, new database name DEVDBNEW.  The versions of the Oracle database on LARRY and ELLISON should be equal by the way!

– In order to get the backup on the same place where it stood on LARRIE ( RMAN gets this from the controlfile): create the same directory. E.g. create directory /backup/LARRIE/DEVDB/rman (on ELLISON!)

As root on ELLISON:
>> mkdir -p /backup/LARRIE/DEVDB/rman
>> chown -R oracle:oinstall /backup

– put the new database name  and home in /etc/oratab :
>> DEVDBNEW:/software/oracle/product/10.2:N

As oracle on ELLISON:
– run oraenv, for getting your right environment:
>> . oraenv (DEVDBNEW).

– Create a password file:
>> cd $ORACLE_HOME/dbs
>> orapwd file=orapwDEVDBNEW password=<password> entries=5

– Create directories for your datafiles:
>> mkdir -p /data/oradata/DEVDBNEW/arch
>> mkdir -p /data/oradata/DEVDBNEW/directories

– Create directories for your backup:
>> mkdir -p /data/oradata/backup/DEVDBNEW/export
>> mkdir -p /data/oradata/backup/DEVDBNEW/rman

– Create directories for the admin-files:
>> mkdir -p /software/oracle/admin/DEVDBNEW/adump
>> mkdir -p /software/oracle/admin/DEVDBNEW/bdump
>> mkdir -p /software/oracle/admin/DEVDBNEW/cdump
>> mkdir -p /software/oracle/admin/DEVDBNEW/udump
>> mkdir -p /software/oracle/admin/DEVDBNEW/scripts
>> mkdir -p /software/oracle/admin/DEVDBNEW/pfile
>> mkdir -p /software/oracle/admin/DEVDBNEW/dpdump

– Create a pfileDEVDBNEW.ora in your own or temp-directory, in my case /home/oracle/dba/job:
>>cat pfileDEVDBNEW.ora:


Pay attention to the last two params.

In this case there had been a mistake when creating the database. The system-files were on …/DEVDB/DEVDB, the rest on …/DEVDB. To solve this, I used the parameter ‘db_file_name_convert’  in the above order.
– Create a spfile from this pfile:

>>sqlplus “/as sysdba”
Connected to an idle instance.
SQL> create spfile=’/software/oracle/product/10.2/dbs/spfileDEVDBNEW.ora’ from pfile=’/home/oracle/dba/job/pfileDEVDBNEW.ora’;

– Put DEVDBNEW in de listener.ora on ELLISON:

(ORACLE_HOME = /software/oracle/product/10.2)
(PROGRAM = extproc)
(ORACLE_HOME = /software/oracle/product/10.2)
(ADDRESS = (PROTOCOL = TCP)(HOST = ELLISON.<domain>.nl)(PORT = 1521))

– Put DEVDBNEW and DEVDB in the tnsnames.ora of ELLISON.

(Host = ELLISON)
(Port = 1521)
(PORT = 1521)

– If the backup is from a while ago, and there are activities in the database, perfirm a log-switch of DEVDB and backup all archive-logs of the DEVDB to the backup-directory:
rman>> backup as copy archivelog all;

– Copy the complete backup-directory from LARRIE to ELLISON.

– Startup the new database (DEVDBNEW on ELLISON) in nomount-mode.

– Start RMAN including the clone-process (auxiliary = DEVDBNEW):

$ORACLE_HOME/bin/rman  target    sys/<passwrd>@DEVDB   auxiliary    sys/<password>@DEVDBNEW
connected to target database: DEVDB (DBID=891379751)
connected to auxiliary database: DEVDBNEW (not mounted)
allocate auxiliary channel aux1 device type disk;
duplicate target database to DEVDBNEW;

And you’re done..

By | 2009-10-18T11:33:01+00:00 October 18th, 2009|Categories: Database, RMAN|Tags: , |0 Comments

About the Author:

Leave A Comment