ADG_REDIRECT_DML in Oracle Active Data Guard 19c

How to repair standby database when is problem with one or more datafiles

In case that recovery of the standby side fell down because of failure of the transferring of the archivelog or based on the another error, in the best case you have to repair one or more datafiles, at worst you have to recreate whole standby database. This post is about the reconstruction one or more datafiles on the standby side.

Terms:
PRIM - primary side
STBY - standby side

If one or more datafiles are unusable, recovery of the standby side crashed automatically. Therefore you don't need to turn off recovery on the standby side. But shipping of archived logs should work without problem.

PRIM: Turn on backup mode

alter tablespace  begin backup; 
 or
alter database begin backup; 
 

STBY: You can delete wrong datafile from the filesystem

  rm /u01/app/oracle/oradata/orcl/example01.dbf
 

PRIM: Copy datafile from the PRIM to STBY

  scp /u01/app/oracle/oradata/orcl/example01.dbf <stby_host_name>:/u01/app/oracle/oradata/stby/
 

PRIM: If it's necessary, create standby controlfile

 alter database create standby controlfile as '/tmp/control_stby.bak';
 

PRIM: Copy standby controlfile from PRIM to STBY

  scp /tmp/control_stby.bak <stby_host_name>:/.../control01.ctl
 
And copy this one control file to all locations, where controlfiles are located.

STBY: You can test manual recovery of standby database

  RECOVER  standby database until cancel;
 

STBY: Turn on automatic recovery of the standby database

    RECOVER MANAGED STANDBY DATABASE DISCONNECT;
 

PRIM: Turn off backup mode

alter tablespace  end backup; 
 or
alter database end backup; 
 

Comments