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

Advertisements

About Alex Zeng
I would be very happy if this blog can help you. I appreciate every honest comments. Please forgive me if I'm too busy to reply your comments in time.

3 Responses to Standby roll forwad by using rman incremental backup

  1. neworacledba says:

    post is very informative

  2. praveen says:

    Hi Alex ,nice article , it is really helpful to me . i have doubt that why Standby and Primary: clean up the incremental backup is needed after recover.

    k.Praveen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: