Infrastructure at your Service

Franck Pachot

RMAN 12c Push and Pull duplicate explained

By Franck Pachot

.
Oracle Database 12c introduced the ‘restore from service’ where you can restore and recover by requesting backupsets from the source. With that feature, the duplicate from active can work in the opposite way: instead of asking the source (target) to send the files to the destination (auxiliary) now the destination can do all the job. Let’s see how it works by comparing the RMAN log of the two methods.

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 a1 device type disk;
  allocate auxiliary channel a2 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 a1 and a2 in auxiliary and only one c1 in target.

CapturePull

Push Based Duplicate

In order to force a push based duplicate, I can mention ‘using copy’ instead of ‘using backupset’. Here I do not mention anything but I allocate more channels in target than in auxiliary and push-based is then used:


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

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

CapturePush

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.

In order to compare, I’ve diff’ed the rman logs so the pull based are prefixed by ‘<‘ and the push based by ‘>’ in the following.

Control File

The first step is to restore the control file. Here is the difference:

Pull based duplicate do a restore from service (VM117 is the target)

<    restore clone from service  '//VM117/CDB' standby controlfile;

Whereas push based do a backup as copy to the auxiliary. Why as copy? Because all the intelligence here is on the target. The auxiliary will not read a backupset.

>    backup as copy current controlfile for standby auxiliary format  '/u02/fast_recovery_area/CDB_SBY/controlfile/crontrol.ctl';

In pull based, the auxiliary channels are doing all the job:


< channel a1: starting datafile backup set restore
< channel a1: using network backup set from service //VM117/CDB
< channel a1: restoring control file
< channel a1: restore complete, elapsed time: 00:00:02
< output file name=/u02/fast_recovery_area/CDB_SBY/controlfile/crontrol.ctl

Whereas in push based, it’s the target that do the work:

> channel c1: starting datafile copy
> copying standby control file
> output file name=/u01/app/oracle/product/12R2EE/dbs/snapcf_CDB.f tag=TAG20160317T152842
> channel c1: datafile copy complete, elapsed time: 00:00:03

Datafiles

Now the datafiles. The pull based is the auxiliary restoring from service:


<    restore
<    from  nonsparse   from service
<  '//VM117/CDB'   clone database
<    ;

On the opposite, the push based is the target sending copies to the auxiliary:


>    backup as copy reuse
>    datafile  1 auxiliary format
>  "/u02/oradata/CDB/system01.dbf"   datafile
>  3 auxiliary format
>  "/u02/oradata/CDB/sysaux01.dbf"   datafile
>  4 auxiliary format
>  "/u02/oradata/CDB/undotbs01.dbf"   datafile
...

Channels are working. For the pull based, I’ve two auxiliary channels:


< channel a1: starting datafile backup set restore
< channel a1: using network backup set from service //VM117/CDB
< channel a1: specifying datafile(s) to restore from backup set
< channel a1: restoring datafile 00001 to /u02/oradata/CDB/system01.dbf
< channel a2: starting datafile backup set restore
< channel a2: using network backup set from service //VM117/CDB
< channel a2: specifying datafile(s) to restore from backup set
< channel a2: restoring datafile 00003 to /u02/oradata/CDB/sysaux01.dbf

for the push based it’s the two channels in target:


> channel c1: starting datafile copy
> input datafile file number=00001 name=/u02/oradata/CDB/system01.dbf
> channel c2: starting datafile copy
> input datafile file number=00003 name=/u02/oradata/CDB/sysaux01.dbf
> output file name=/u02/oradata/CDB/system01.dbf tag=TAG20160317T152850
> channel c1: datafile copy complete, elapsed time: 00:00:46
> channel c1: starting datafile copy
> input datafile file number=00009 name=/u02/oradata/CDB/pdb/sysaux01.dbf
> output file name=/u02/oradata/CDB/sysaux01.dbf tag=TAG20160317T152850

Conclusion

Hope it helps to remember how it works:

  • Pull: The auxiliary restores from target. All ‘backup as backupset’ optimizations are available: compression, section size,… Non formatted blocks and unnecessary undo is not transfered.
  • 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.

3 Comments

  • Muhammad Khalil says:

    very clear and informative, thanks for sharing.

  • Laura Sallwasser says:

    Thank you for the very clear explanation. The pull method is just what we need for our next clone, where the large source tablespaces were purged, but database reorganization is still pending.

  • DITAL says:

    Getting error, when trying pull method –

    RMAN-03002: failure of Duplicate Db command at 09/19/2019 01:49:43
    RMAN-05501: aborting duplication of target database
    RMAN-06217: not connected to auxiliary database with a net service name

    =============================
    RMAN SCRIPT:

    CONNECT TARGET sys/”xxxx”@dg12pri
    CONNECT AUXILIARY sys/”xxxx”

    run {

    allocate channel p1 type disk;
    allocate auxiliary channel s1 type disk;
    allocate auxiliary channel s2 type disk;
    allocate auxiliary channel s3 type disk;
    allocate auxiliary channel s4 type disk;
    allocate auxiliary channel s5 type disk;
    allocate auxiliary channel s6 type disk;
    allocate auxiliary channel s7 type disk;
    allocate auxiliary channel s8 type disk;

    sql ‘alter system archive log current’;
    duplicate database for standby from active database USING BACKUPSET NOFILENAMECHECK
    spfile
    parameter_value_convert ‘+DATAC3′,’+DATAC4′,’dg12pri’,’dg12stb’
    set ‘db_unique_name’=’dg12stb’
    set ‘db_name’=’dg12′
    set fal_server=’dg12pri’
    set control_files=’+DATAC4/dg12stb/CONTROLFILE/control01.ctl’
    set db_recovery_file_dest=’+RECOC4′
    set db_create_file_dest=’+DATAC4′
    set DB_CREATE_ONLINE_LOG_DEST_1=’+DATAC4′
    set local_listener=”
    set audit_file_dest=’/u02/app/oracle/admin/dg12stb/adump’
    set use_large_pages=’true’
    set db_domain=’test.com’
    set cluster_database=’false’;
    }

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Franck Pachot
Franck Pachot

Principal Consultant / Database Evangelist