Oct 10, 2017

RMAN Duplicate in 12c - Push and Pull duplicate explained

RMAN duplication can be performed by using an existing backup or by directly duplicating the database using ACTIVE DUPLICATE.

Prior to Oracle Database 12c,  the ACTIVE DUPLICATE process used production database processes to send image copies across the network. This could be a time-consuming activity because the duplication process is directly proportional to the database size. Now, with 12c, the database duplication process has been improved, with the use of backup sets instead of image copies. As a result, the database size is relatively smaller because RMAN skips unused blocks, committed undo blocks etc. Plus, you can use compression and multi-section options for even faster duplication. Moreover, auxiliary channels from the destination site are used to PULL the backups over the network, as opposed to the PUSH method, used prior to 12c.

Pull Based Duplicate:

In 12c the pull method is the default. Here there are two additional reasons for it: I allocate more channels in auxiliary than in target, and I specify ‘from backupset’

RMAN>
echo set on
 run {
  allocate channel c1 device type disk;
  allocate auxiliary channel aux1 device type disk;
  allocate auxiliary channel aux2 device type disk;
  duplicate database for standby from active database using backupset nofilenamecheck;
}

In pull based duplicate, the auxiliary channels will connect to the target. This means that the credentials and connection string you used to connect target must be available (tnsnames, etc.) from the auxiliary.

I allocated 2 channels aux1 and aux2 in auxiliary and only one c1 in target.

Push Based Duplicate:

In order to force a push based duplicate, I allocate more channels in target than in auxiliary, and do not specify backupset.

RMAN>
echo set on
 run {
  allocate channel c1 device type disk;
  allocate channel c2 device type disk;
  allocate auxiliary channel aux1 device type disk;
  duplicate database for standby from active database nofilenamecheck;
}

I allocated 2 channels c1 and c2 in target and only one aux1 in auxiliary.

In push based duplicate the target will connect to the auxiliary. So SQL*Net connection must be ok for that. You probably need to define a static entry for the auxiliary in its listener so that the target can connect to the nomount instance.

Note:
Pull: The auxiliary restores from target. All ‘backup as backupset’ optimizations are available: compression, etc. Non formatted blocks and unnecessary undo is not transferred.

Push: Use it if you want the target to do all the job. More data will be transferred because it’s full datafiles. Target must be able to connect to auxiliary.


-- Typical rman backup script

-- archivelog backup
run {
allocate channel c1 device type sbt parms="SBT_LIBRARY=/opt/commvault/Base/libobk.so,BLKSIZE=1048576";
set command id to '2.1';
sql 'alter system archive log current';
backup archivelog all format 'prod_$DateTime_full_al_%U.bkp' not backed up 1 times tag '$DateTime_full_al';
-- Full backup 
run{
allocate channel c1 device type sbt parms="SBT_LIBRARY=/opt/commvault/Base/libobk.so,BLKSIZE=1048576";
sql 'alter system archive log current';
backup spfile format '/u03/fra/prod/prod_$DateTime_full_sp.bkp' tag '$DateTime_full_sp';
sql "create pfile=''/u03/fra/prod/prod_$DateTime_full_pf.bkp'' from spfile";
backup  as backupset current controlfile format '/u03/fra/prod/prod_$DateTime_full_cf.bkp' tag '$DateTime_full_cf';
sql "alter database create standby controlfile as ''/u03/fra/prod/prod_$DateTime_full_sf.bkp''";
sql "alter database backup controlfile to trace as ''/u03/fra/prod/prod_$DateTime_full_tf.bkp''";
backup incremental level 0 database format '/u03/fra/prod/prod_$DateTime_full_db_%U.bkp' tag '$DateTime_full_db';
sql 'alter system archive log current';
backup  archivelog all format '/u03/fra/prod/prod_$DateTime_full_al_%U.bkp' not backed up 2 times tag '$DateTime_full_al';
delete noprompt archivelog all backed up 2 times to sbt;
}

No comments:

Post a Comment

Translate >>