Monday, May 21, 2018

Warning: ORA-16857: standby disconnected from redo source for longer than specified threshold

DGMGRL> show configuration

Configuration - t2est_dg

  Protection Mode: MaxPerformance
  Members:
  t2estp - Primary database
    t2estd - Physical standby database
      Warning: ORA-16857: standby disconnected from redo source for longer than specified threshold

Fast-Start Failover: DISABLED

Configuration Status:
WARNING   (status updated 23 seconds ago)

DGMGRL>


Noticed that the redo log file size and standby logfile on primary is 100M and on DR redo as well as standby log is 50M.


To get the size and status of the files query v$log and v$standby_log. The size of the log and standby logfile should be the same on primary and DR database.

First step is change the standby file management to manual and stop the real time log apply.

-- Primary
alter system set standby_file_management='MANUAL' scope=both sid='*';
alter system set log_archive_dest_state_2='defer' scope=both sid='*';

On DR stop the recovery process and change the file management to manual as well.

-- on DR
alter database recover managed standby database cancel;
alter system set standby_file_management='MANUAL' scope=both sid='*';


Now when you query from v$log and v$standby_log on DR you will see that all the log files have status of UNUSED and all standby logfiles have status of UNASSIGNED

This is perfect. Now what I have done it added some dummy files to log file and standby log file on dr  and then remove the 50M files .

After that I have added new 100M files with the proper group and all done.

-- on DR dummy files

ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 31 ('+DATA','+FRA') SIZE 100M;
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 32 ('+DATA','+FRA') SIZE 100M;
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 33 ('+DATA','+FRA') SIZE 100M;

ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 34 ('+DATA','+FRA') SIZE 100M;
ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 35 ('+DATA','+FRA') SIZE 100M;
ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 36 ('+DATA','+FRA') SIZE 100M;

ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 SIZE 100M; 
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 SIZE 100M; 
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 SIZE 100M; 
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 SIZE 100M; 

ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 SIZE 100M; 
ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 SIZE 100M; 
ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 SIZE 100M; 
ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 SIZE 100M; 

-- on DR correct files (this is to maintain the consistency of group 1,2,3,4....)

ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 1 ('+DATA','+FRA') SIZE 100M;
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 2 ('+DATA','+FRA') SIZE 100M;
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 3 ('+DATA','+FRA') SIZE 100M;

ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 4 ('+DATA','+FRA') SIZE 100M;
ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 5 ('+DATA','+FRA') SIZE 100M;
ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 6 ('+DATA','+FRA') SIZE 100M;


ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 SIZE 100M; 
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 SIZE 100M; 
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 SIZE 100M; 
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 SIZE 100M; 

ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 SIZE 100M; 
ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 SIZE 100M; 
ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 SIZE 100M; 
ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 SIZE 100M; 

-- Remove the unwanted files
alter database drop logfile group 31;
alter database drop logfile group 32;
alter database drop logfile group 33;
alter database drop logfile group 34;
alter database drop logfile group 35;
alter database drop logfile group 36;

alter database drop logfile group 23;
alter database drop logfile group 24;
alter database drop logfile group 25;
alter database drop logfile group 26;
alter database drop logfile group 27;
alter database drop logfile group 28;


Once that is done.

I will just reset the parameters to original values on primary and DR

-- on primary and DR
alter system set standby_file_management='AUTO' scope=both sid='*';

-- on Primary
alter system set log_archive_dest_state_2='enable' scope=both sid='*';


Now if you check DGMGRL it is all good.

DGMGRL> show configuration

Configuration - t2est_dg

  Protection Mode: MaxPerformance
  Members:
  t2estp - Primary database
    t2estd - Physical standby database 

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 48 seconds ago)

DGMGRL> 


I will just restart the DR database using srvctl. That's it!!

Have a good day :-)