There are many documents that explains how to resolve a gap on the standby database using rman incremental backups. It is pretty useful when you do not want to ship and apply all the missing archive logs to refresh standby database. Recently I had such problem on a new dataguard. My problem was not the size of the missing archive logs that I need to ship and apply. The archive logs were missing on the primary system. Instead of restoring the archivelogs from the tape I prefer to use incremental backup from the primary database.
But It did not work for me. Later I realized that I was calculating wrong scn on standby. Restore time of the datafiles on standby was 4 days before the standby controlfile that I use. When I use the “select current_scn from v$database;” to calculate the scn It gave me the scn on the control file which was pretty close to the primary. But scn on the datafiles was 4 days ago. When I used the scn on the datafiles I was successfully restored the incremental backup and my problem was resolved.
MOS doc :
Steps to perform for Rolling forward a standby database using RMAN Incremental Backup. (Doc ID 836986.1)
How it works :
1 – Determine latest scn on the dataguard. this must reflect the scn on the datafiles so it is better to use x$kcvfh table (take the minimum SCN from the below queries)
SQL> select current_scn from v$database; -- If no READ ONLY Tablespaces/datafiles in database use SQL> select min(fhscn) from x$kcvfh; -- If READ ONLY tablespaced/datafiles in database use SQL> select min(f.fhscn) from x$kcvfh f, v$datafile d where f.hxfil =d.file# and d.enabled != 'READ ONLY' ;
2 – Take incremental backup on the primary database from that scn
RMAN> BACKUP DEVICE TYPE DISK INCREMENTAL FROM SCN 750983 DATABASE FORMAT '/primary_archive/incr_standby_%U';
3 – Ship the incremental backup to the standby location (scp , ftp or aircargo 🙂 whatever you like )
4 – Catalog the backup on the standby database
RMAN> CATALOG START WITH '/standby_archive/incrback/';
5 – Stop the recovery on the standby database
RMAN> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
6 – Restore the standby database using the cataloged incremental backup
RMAN> RECOVER DATABASE NOREDO;