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.