Standby roll forwad by using rman incremental backup

When the physical standby database lags far behind the primary database, using rman incremental backup is better than applying tons of archived logs. Here are steps.

Step1.Standby database: check the current scn

SQL> select current_scn from v$database;
CURRENT_SCN
—————————————-
788209520

Step2. Primary database: incremental backup from the scn.

run {
allocate channel dev_0 device type disk;
allocate channel dev_1 device type disk;
allocate channel dev_2 device type disk;
backup as compressed backupset incremental from SCN 788209520 database
format=’/u01/app/oracle/reorg/wordpress/%d_standby_scn_%s_%p.dbf’
include current controlfile for standby
filesperset=5 tag ‘FOR STANDBY’;;
}

Step3. copy the backup files from primary db server to standby db server.

Step4. Standby db: recover using incremental backup

RMAN>catalog start with ‘/u01/app/oracle/reorg/wordpress/’;
run {
allocate channel dsk0 type disk;
allocate channel dsk1 type disk;
allocate channel dsk2 type disk;
restore standby controlfile to ‘/u01/app/oracle/reorg/wordpress/wordpress_
standby.ctl’;
recover database noredo;
}

Step5. Standby database: shutdown and copy the new standby controlfile to the controlfile locations

Step6. Standby database: startup and check

–startup
SQL> startup nomount
SQL> alter database mount standby database;
–check status
SQL> select current_scn from v$database;

CURRENT_SCN
———–
892908281
SQL> SELECT THREAD#, max(SEQUENCE#),APPLIED
FROM V$ARCHIVED_LOG
group by thread#,applied;
THREAD# MAX(SEQUENCE#) APP
———- ————– —
1 23778 NO
2 20874 NO

SQL> SELECT * FROM V$ARCHIVE_GAP;

no rows selected
–start normal recover
SQL> alter database recover managed standby database disconnect from session;

Step7. Standby : re-add the standby logfiles if used

ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 (‘/u02/origlog/wordpress/wordpress_log_t1_g7_m1.dbf’,'/u03/mirrlog/wordpress/wordpress_log_t1_g7_m2.dbf’) reuse;
ALTER DATABASE ADD STANDBY LOGFILE thread 2 GROUP 11 (‘/u02/origlog/wordpress/wordpress_log_t2_g11_m1.dbf’,'/u03/mirrlog/wordpress/wordpress_log_t2_g11_m2.dbf’) reuse;

Step8. Standby and Primary: clean up the incremental backup

RMAN> DELETE BACKUP TAG ‘FOR STANDBY’;
rm /u01/app/oracle/reorg/wordpress/*_standby_scn_*
rm /u01/app/oracle/reorg/wordpress/wordpress_standby.ctl

Leave a Reply