RMAN Duplicate
RMAN Duplicate
/NEWSID/'
We don't need all the other parameters as the clone will copy the SPFILE from
e primary database. If you are duplicating a database on the same machine you
ll probably need to create a PFFILE/SPFILE manually from the primary database
FILE, manually change the values and avoid the SPFILE clause in the duplicate
mmand.
Create any
$ mkdir -p
$ mkdir -p
$ mkdir -p
th
wi
SP
co
Make the backup files from the source database available to the destination serv
er. That can be done by either copying them to the matching location on the dest
ination server, or placing them on a shared drive. If you are copying the files,
you may want to use the following type of commands.
$ scp -r oracle@ol5-112-dup1:/u01/app/oracle/fast_recovery_area/DB11G/archivelog
/u01/app/oracle/fast_recovery_area/DB11G
$ scp -r oracle@ol5-112-dup1:/u01/app/oracle/fast_recovery_area/DB11G/backupset
/u01/app/oracle/fast_recovery_area/DB11G
$ scp -r oracle@ol5-112-dup1:/u01/app/oracle/fast_recovery_area/DB11G/autobackup
/u01/app/oracle/fast_recovery_area/DB11G
Connect to the duplicate instance.
$ ORACLE_SID=DB11G; export ORACLE_SID
$ sqlplus / as sysdba
Start the database in NOMOUNT mode.
SQL> STARTUP NOMOUNT;
With the duplicate database started we can now connect to it from RMAN. For the
duplication to work we must connect to the duplicate database (AUXILIARY), but d
epending on the type of duplication we are doing we may optionally connect to th
e original database (TARGET) and/or the recovery catalog (CATALOG).
$ ORACLE_SID=DB11G; export ORACLE_SID
# No target or catalog. Metadata comes from backups.
$ rman AUXILIARY /
# Target, but no catalog. Metadata comes from target database controlfile.
$ rman TARGET sys/password@DB11G-SOURCE AUXILIARY /
# Catalog, but no target. Metadata comes from the RMAN catalog.
$ rman CATALOG rman/password@rman-catalog AUXILIARY /
# Target and catalog. Metadata can come from the target controlfile or the catal
og.
$ rman TARGET sys/password@DB11G-SOURCE CATALOG rman/password@rman-catalog AUXIL
IARY /
We can then duplicate the database using one of the following commands. Remember
, remove the SPFILE clause if you have manually created a full PFILE or SPFILE.
# Backup files are in matching location to that on the source server.
# Duplicate database to TARGET's current state.
DUPLICATE TARGET DATABASE TO DB11G
SPFILE
NOFILENAMECHECK;
# Duplicate database to TARGET's state 4 days ago.
The time it takes to complete varies depending on the size of the database and t
he specification of the server. Once the process is finished RMAN produces a com
pletion message and you have your duplicate instance.
Active Database Duplication
Oracle 11g introduced the ability to create duplicate databases directly without
the need for a backup. This is known as active database duplication. The proces
s is similar to the backup-based duplication, with a few exceptions.
First, and most obviously, you don't need a backup of the source system, but it
does have to be in ARCHIVELOG mode.
The passwords in the password files must match for both servers, so remember to
set the correct password when creating the password file on the destination serv
er.
Both the source and destination database servers require a "tnsnames.ora" entry
for the destination database. In this case I added the following to each server.
The destination server still requires the source entry shown in the previous se
ction.