Resolving Archived Redo Log Gaps Using Incremental Backups
Imagine that due to the network failure, some archived redo log fileswere not shipped to the standby database and were deleted from the primary database according to the defined RMAN retention policy. Since the next generated archived redo log file cannot be jumped into before successfully applying all of them one by one in subsequent order, either create a standby database from scratch, or
Sure, there is another option. By applying the necessary incremental backup taken from the primary database, take the database forward and bypass applying missing archived redo log files.
select name,open_mode,database_role from v$database; (On primary)
select name,open_mode,database_role from v$database; (On standby)
SQL> select max(sequence#) from v$archived_log where archived='YES'; (On primary)
MAX(SEQUENCE#)
--------------
4250
SQL> select max(sequence#) from v$archived_log where applied='YES'; (On standby)
MAX(SEQUENCE#)
--------------
3670
****REFRESH STANDBY USING INCREMENTAL(SCN BASED) BACKUP****
STEP1—STOP THE MRP PROCESS
Alter database recover managed standby database cancel;
STEP2—ON THE STANDBY DATABASE,
col current_scn for 99999999999999999
SELECT CURRENT_SCN FROM V$DATABASE
---------------------------------
11009482886
STEP3—IN RMAN ,CONNECT TO THE PRIMARY DATABASE AND CREATE AN INCREMENTAL BACKUP FROM THE(lowest) SCN DERIVED IN THE PREVIOUS STEP
In primary
[oracle@LESFDCDBIDP01 inc]$rman target /
run
{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
allocate channel ch3 device type disk;
backup as compressed backupset incremental from SCN 11009482886 database format '/backup/RMAN_BKP/inc/INCR_%U.dbf';
backup current controlfile for standby format '/backup/RMAN_BKP/inc/standbyctl.ctl';
}
alter database create standby controlfile as '/u01/xxx/xxxx/std_control.ctl';
STEP4—TRANSFER ALL BACKUP SETS AND CONTROLFILE CREATED ON THE PRIMARY SYSTEM TO THE STANDBY SYSTEM
STEP5— ON STANDBY, REPLACE THE EXISTING CONTROLFILE WITH NEW CONTROLFILE
alter database recover managed standby database cancel;
SQL> shut immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Note: Replace the controlfile with the new one
STEP6— MOUNT STANDBY DATABASE
SQL> startup mount;
STEP7—ON THE STANDBY ,CATALOG THE BACKUPPIECES
RMAN> catalog start with '/backup/RMAN_BKP/inc';
SQL>Alter database recover managed standby database cancel;
STEP8— RECOVER STANDBY
RMAN > RECOVER DATABASE NOREDO;
RMAN will apply only incremental backups to the standby database.
STEP9-Once its successfully completed. Please start MRP.
alter database recover managed standby database disconnect from session;
Switch logfile (On Primary)
alter system switch logfile;
STEP10-Verify sync
select max(sequence#) from v$archived_log where archived='YES'; (On primary)
select max(sequence#) from v$archived_log where archived='YES'; (On standby)
....
Enjoy the work and do like me if you like this article!!!