Last week I came across a scenario where a standby database went out of synch with the primary and there was a big gap of archive logs to be applied. Instead of rebuilding the standby database from scratch or restoring and applying a zillion archives, we can make use of a feature available from the version 10.2 onwards called the standby roll forward that uses RMAN incremental backup to apply the changes on the standby.
For databases on non-ASM, it should work with the first 4 steps as indicated below.
To keep it simple, I have outlined the steps below and have attached the logs for reference.
1) Identify the last SCN on the Standby, take the minimum value returned by the below queries for further steps.
1
2
3
4
5
6
7
8
9
10
| SQL> col current_scn for 99999999999999999999999 col int_scn for 99999999999999999999999 select current_scn FROM V$ DATABASE ; select min (fhscn) int_scn from x$kcvfh; CURRENT_SCN ----------------- 47987632 |
2) Take an incremental backup on the primary database from this SCN to the current point.
The incremental backup files will be generated on the filesystem under the directory “/ora001/backup/” in the example.
Need to make sure that there is sufficient space in the filesystem to hold the backup. In this case, the backup files sized nearly 1.2G.
The incremental backup files will be generated on the filesystem under the directory “/ora001/backup/” in the example.
Need to make sure that there is sufficient space in the filesystem to hold the backup. In this case, the backup files sized nearly 1.2G.
1
2
| RMAN> CONFIGURE CHANNEL c1 DEVICE TYPE DISK FORMAT '/ora001/backup/std_%U' ; RMAN> BACKUP INCREMENTAL FROM SCN 47987632 DATABASE ; |
3) SCP the backup files to the server where the standby database is running and catalog the backup.
1
| RMAN> CATALOG START WITH '/ora001/backup/std_%U' ; |
This makes the controlfile aware of the incremental backup.
4) Recover the standby database.
1
2
| RMAN> RECOVER DATABASE NOREDO; |
5) Check the archive gap and the SCN to see if the DB has applied the changes.
1
2
3
4
| SQL> col CURRENT_SCN for 99999999999999999999999 select * from v$archive_gap; select current_scn from v$ database ; |
The standby is in good shape if the SCN returned is a bigger value and there are no gaps.
more help
http://shivanandarao-oracle.com/2012/03/26/roll-forward-physical-standby-database-using-rman-incremental-backup/
more help
http://shivanandarao-oracle.com/2012/03/26/roll-forward-physical-standby-database-using-rman-incremental-backup/
No comments:
Post a Comment