This blog demonstrates the use of an RMAN duplicate using “active” RMAN technology. Active duplication is available with Oracle’s Enterprise Database product starting with 11gR2 forward 11.2.x.x.x, 12c etc.
Basically “active duplicate” uses the control file and the currently open database as a source to clone / duplicate from – no backup is required. It is required that the open DB being cloned from be in archivelog mode and there are restrictions on what version of the DBs you can use for a source and target together, to be sure… use the same Oracle version. There are other restrictions on cross platform use – an Endian change (byte order change) won’t work – e.g. AIX to Linux… see Oracle’s doc if you are cloning to a different OS. If the source and target are the same platform, you are good for certain.
One important thing to note in RMAN nomenclature / syntax AUXILIARY is the target, and target is the source when doing an RMAN DB duplicate. So in this blog, when I say source and target, in RMAN speak, that is target and auxiliary – respectively. If you have not done a bunch of conventional RMAN duplicates, this is likely somewhat confusing. Re-read the paragraph, or see the RMAN connect syntax below, or better yet both.
Non-active duplicates use an existing full RMAN backup and archivelogs, where the target is a backup known to a local control file – this is not being shown here.
Note the directory structures between the two environments with the exception of a change SID/DB_NAME used in those directory structures.
In the case below “GOLD” is the source, and “GGTARGET” is the target or in the case of RMAN duplicate referred to as the Auxiliary
add entries to both servers $ORACLE_HOME/network/admin/tnsnames.ora
(ADDRESS = (PROTOCOL = TCP)(HOST = o68-122db.localdomain)(PORT = 1521))
(SERVER = DEDICATED)
(SERVICE_NAME = GGTARGET.localdomain)
(ADDRESS = (PROTOCOL = TCP)(HOST = oel66-noDB.localdomain)(PORT = 1521))
(SERVER = DEDICATED)
(SERVICE_NAME = gold.localdomain)
create on the new db side an $ORACLE_HOME/network/admin/Listener.ora
(GLOBAL_DBNAME = GGTARGET)
(ORACLE_HOME = /u01/app/oracle/product/12.2.0/dbhome_1)
(SID_NAME = GGTARGET)
(ADDRESS = (PROTOCOL = TCP)(HOST = o68-122db)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
The easy way is to match the source and target dir structure as closely as possible and then use “convert” parameters in the RMAN duplicate command shown later
mkdir -p /u01/app/oracle/oradata/GGTARGET
mkdir -p /u01/app/oracle/fast_recovery_area/GGTARGET
mkdir -p /u01/app/oracle/fast_recovery_area/GGTARGET/archivelog
mkdir -p /u01/app/oracle/fast_recovery_area/GGTARGET/backupset
mkdir -p /u01/app/oracle/fast_recovery_area/GGTARGET/autobackup
mkdir -p /u01/app/oracle/admin/GGTARGET/adump
Either copy the source $ORACLE_HOME/dbs/orapwdSID.ora to the target and rename or create a new one on the target with the same password as the source.
Create on the target/auxiliary $ORACLE_HOME/dbs/initSID.ora with only the DB_NAME, SGA_MAX_SIZE, and SGA_TARGET
Where you want the db created:
sqlplus / as sysdba
startup nomount pfile=/u01/app/oracle/product/12.2.0/dbhome_1/dbs/initGGTARGET.ora
# if you are on the clone to host:
rman TARGET sys/Junker11#@gold AUXILIARY /
# or you can… if you are on the clone from:
rman TARGET sys/Junker11# AUXILIARY sys/Junker11#@GGTARGET
Then from your RMAN session just connected
DUPLICATE DATABASE TO GGTARGET
FROM ACTIVE DATABASE