RollForward a Physical Standby Database using RMAN Incremental Backups

In some scenarios where the standby database lags far behind from the primary database. the incremental backups can be used to roll forward the physical standby database to have it in sync with the primary database.

Our Database version: 11.2.0.4 .

Primay database: VCP                                             Standby Database: VCPS
Primary Host:  stbyp01                                             Standby Host:  stbyp02

Step 1: Take a note of the Current SCN of the Physical Standby Database.

SYS:VCP> select current_scn from v$database;

CURRENT_SCN
-----------
  382836133

Step 2: Stop Redo Apply on the standby database
DGMGRL> connect sys/vierpunkt
Connected.
DGMGRL> edit database 'VCPS' set state='LOG-APPLY-OFF';
Succeeded.
DGMGRL> exit

Step 3: On the Primary database, take the incremental SCN from the step 1 ( 382836133 ) Connect to the primary database and take the incremental SCN backup.
[stbyp01:oradba:VCP]/oracle/admin#rman target / 
RMAN> backup incremental from scn 382836133 DATABASE FORMAT '/oradata/VCPS/backup/db/ForStandby_%U' ;
Starting backup at 15-01-09 12:55
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00012 name=+DATA/vcp/data/users3.dbf
input datafile file number=00011 name=+DATA/vcp/data/users2.dbf
input datafile file number=00013 name=+DATA/vcp/data/users4.dbf
input datafile file number=00014 name=+DATA/vcp/data/users5.dbf
input datafile file number=00010 name=+DATA/vcp/data/users1.dbf
input datafile file number=00005 name=+DATA/vcp/data/indx1.dbf
input datafile file number=00008 name=+DATA/vcp/data/indx3.dbf
input datafile file number=00006 name=+DATA/vcp/data/indx2.dbf
input datafile file number=00007 name=+DATA/vcp/data/indx4.dbf
input datafile file number=00009 name=+DATA/vcp/data/wcaudit1.dbf
input datafile file number=00003 name=+DATA/vcp/undo/undo1.dbf
input datafile file number=00004 name=+DATA/vcp/data/blobs1.dbf
input datafile file number=00002 name=+DATA/vcp/sysaux/sysaux1.dbf
input datafile file number=00015 name=+DATA/vcp/data/blobs2.dbf
input datafile file number=00020 name=+DATA/vcp/data/users6.dbf
input datafile file number=00021 name=+DATA/vcp/data/users7.dbf
input datafile file number=00001 name=+DATA/vcp/system/system1.dbf
input datafile file number=00016 name=+DATA/vcp/data/indx5.dbf
input datafile file number=00017 name=+DATA/vcp/data/indx6.dbf
input datafile file number=00018 name=+DATA/vcp/data/indx7.dbf
input datafile file number=00019 name=+DATA/vcp/data/indx8.dbf
channel ORA_DISK_1: starting piece 1 at 15-01-09 12:56
channel ORA_DISK_1: finished piece 1 at 15-01-09 13:25
piece handle=/oradata/VCPS/backup/db/ForStandby_vgps9mv4_1_1 tag=TAG20150109T125603 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:29:06
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 15-01-09 13:25
channel ORA_DISK_1: finished piece 1 at 15-01-09 13:25
piece handle=/oradata/VCPS/backup/db/ForStandby_vlps9olm_1_1 tag=TAG20150109T125603 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 15-01-09 13:25
Step 4: Take the standby controlfile backup of the primary database.
RMAN> backup current controlfile for standby format '/oradata/VCPS/backup/ctrl/stnd_%U.ctl';

Starting backup at 15-01-09 13:55
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including standby control file in backup set
channel ORA_DISK_1: starting piece 1 at 15-01-09 13:55
channel ORA_DISK_1: finished piece 1 at 15-01-09 13:55
piece handle=/oradata/VCPS/backup/ctrl/stnd_vmps9qem_1_1.ctl tag=TAG20150109T135534 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 15-01-09 13:55

Step 5: Our backup is on shared storage. we dont need to copy it to standby host. if you dont have the shared storage , you have to copy it to the standby host. On Standby DB.
RMAN> shutdown immediate

using target database control file instead of recovery catalog
Oracle instance shut down

RMAN> startup mount

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area    5346328576 bytes

Fixed Size                     2190976 bytes
Variable Size               1191186816 bytes
Database Buffers            4110417920 bytes
Redo Buffers                  42532864 bytes

[stbyp02:oradba:VCPS]/oradata/VCPS/backup/db#rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Jan 9 13:37:18 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: VCP (DBID=2601063843, not open)

RMAN> catalog start with '/oradata/VCPS/backup/db';

using target database control file instead of recovery catalog
searching for all files that match the pattern /oradata/VCPS/backup/db

List of Files Unknown to the Database
=====================================
File Name: /oradata/VCPS/backup/db/ForStandby_vgps9mv4_1_1
File Name: /oradata/VCPS/backup/db/ForStandby_vlps9olm_1_1

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /oradata/VCPS/backup/db/ForStandby_vgps9mv4_1_1
File Name: /oradata/VCPS/backup/db/ForStandby_vlps9olm_1_1

Step 6: Recover the standby database: On Standby Database
RMAN> recover database noredo;
Starting recover at 15-01-09 13:38
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1873 device type=DISK
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: +DATA/vcps/system/system1.dbf
destination for restore of datafile 00002: +DATA/vcps/sysaux/sysaux1.dbf
destination for restore of datafile 00003: +DATA/vcps/undo/undo1.dbf
destination for restore of datafile 00004: +DATA/vcps/data/blobs1.dbf
destination for restore of datafile 00005: +DATA/vcps/data/indx1.dbf
destination for restore of datafile 00006: +DATA/vcps/data/indx2.dbf
destination for restore of datafile 00007: +DATA/vcps/data/indx4.dbf
destination for restore of datafile 00008: +DATA/vcps/data/indx3.dbf
destination for restore of datafile 00009: +DATA/vcps/data/wcaudit1.dbf
destination for restore of datafile 00010: +DATA/vcps/data/users1.dbf
destination for restore of datafile 00011: +DATA/vcps/data/users2.dbf
destination for restore of datafile 00012: +DATA/vcps/data/users3.dbf
destination for restore of datafile 00013: +DATA/vcps/data/users4.dbf
destination for restore of datafile 00014: +DATA/vcps/data/users5.dbf
destination for restore of datafile 00015: +DATA/vcps/data/blobs2.dbf
destination for restore of datafile 00016: +DATA/vcps/data/indx5.dbf
destination for restore of datafile 00017: +DATA/vcps/data/indx6.dbf
destination for restore of datafile 00018: +DATA/vcps/data/indx7.dbf
destination for restore of datafile 00019: +DATA/vcps/data/indx8.dbf
destination for restore of datafile 00020: +DATA/vcps/data/users6.dbf
destination for restore of datafile 00021: +DATA/vcps/data/users7.dbf
channel ORA_DISK_1: reading from backup piece /oradata/VCPS/backup/db/ForStandby_vgps9mv4_1_1
channel ORA_DISK_1: piece handle=/oradata/VCPS/backup/db/ForStandby_vgps9mv4_1_1 tag=TAG20150109T125603
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:14:06
Finished recover at 15-01-09 13:52

Step 7: Shutdown the standby database and start it in nomount state. the controlfile is needed to restore to standby database. On Standby Database
RMAN> shutdown immediate

using target database control file instead of recovery catalog
Oracle instance shut down

RMAN> startup nomount

connected to target database (not started)
Oracle instance started

Total System Global Area    5346328576 bytes

Fixed Size                     2190976 bytes
Variable Size               1191186816 bytes
Database Buffers            4110417920 bytes
Redo Buffers                  42532864 bytes

RMAN> restore standby controlfile from '/oradata/VCPS/backup/ctrl/stnd_vmps9qem_1_1.ctl';

Starting restore at 15-01-09 13:57
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1297 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output file name=+DATA/vcps/loga/control1.ctl
output file name=+FLASH/vcps/logb/control2.ctl
Finished restore at 15-01-09 13:57

Step 8: Shutdown the standby database and startup the standby database in mount state
RMAN> shutdown immediate

using target database control file instead of recovery catalog
Oracle instance shut down

RMAN> startup mount

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area    5346328576 bytes

Fixed Size                     2190976 bytes
Variable Size               1191186816 bytes
Database Buffers            4110417920 bytes
Redo Buffers                  42532864 bytes

Step 9: if the data file location of primary and standby databases are different , then you need to do this step. if not, please go to step 10. On Standby Database:
RMAN> catalog start with '+DATA/vcps/data';

Starting implicit crosscheck backup at 15-01-09 13:59
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=2017 device type=DISK
Crosschecked 2 objects
Finished implicit crosscheck backup at 15-01-09 14:00

Starting implicit crosscheck copy at 15-01-09 14:00
using channel ORA_DISK_1
Crosschecked 2 objects
Finished implicit crosscheck copy at 15-01-09 14:00

searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: +flash/VCPS/ARCHIVELOG/2015_01_08/thread_1_seq_9273.3147.868406551
File Name: +flash/VCPS/ARCHIVELOG/2015_01_08/thread_1_seq_9274.1301.868406627
File Name: +flash/VCPS/ARCHIVELOG/2015_01_08/thread_1_seq_9275.2885.868406627
.
.
.
File Name: +flash/VCPS/ARCHIVELOG/2014_12_27/thread_1_seq_7683.2520.867448969
File Name: +flash/VCPS/ARCHIVELOG/2014_12_27/thread_1_seq_7691.1997.867452569

searching for all files that match the pattern +DATA/vcps/data

Do you really want to catalog the above files (enter YES or NO)? YES
cataloging files...
no files cataloged

RMAN> switch database to copy;

Step 10: Start the Managed Recovery Process
DGMGRL> connect sys/vierpunkt
Connected.
DGMGRL> edit database 'VCPS' set state='ONLINE';
Succeeded.

Step 11: Check the primary and standby with dataguard
DGMGRL> show database 'VCPS';

Database - VCPS

  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   0 seconds (computed 0 seconds ago)
  Apply Lag:       0 seconds (computed 0 seconds ago)
  Apply Rate:      0 Byte/s
  Real Time Query: ON
  Instance(s):
    VCPS

Database Status:
SUCCESS

DGMGRL> show configuration

Configuration - VCPS

  Protection Mode: MaxAvailability
  Databases:
    VCP  - Primary database
    VCPS - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
Previous
Next Post »
Thanks for your comment