Using Recover Standby Database From Service To Fix Physical Data Guard

Oracle Data Guard is a secondary database environment used for disaster recovery, failover, or data recovery, however, this environment can also experience failures, such as synchronization issues, maintenance, and others.

Oracle has simplified the process of fixing the database in the Data Guard environment with the command Recover Standby Database From Service, which uses a connection to the primary environment to perform an incremental refresh between the primary and standby environments.

Make sure the following prerequisites are met:

  • Connectivity must be established between the standby database and the primary database. This can be done by adding a corresponding entry for the primary database in the standby database’s tnsnames.ora file.
  • The password file for both the primary and standby databases must be the same.
  • The COMPATIBLE parameter in the initialization parameter file of both the primary and standby databases must be set to 12.0.

Let’s assume we have a production database named ORCL and a Data Guard database named ORDG on server orasrvdg. See the instructions below.

First of all, we need stop database and startup it in mount mode. If you are in Oracle RAC environment, keep only one instance running.

srvctl stop database -d ordg
srvctl start database -d ordg -o mount

Now, we need to stop Data Guard synchronization. If you are using broker, execute the commands below on data broker manager:

dgmgrl "/as sysdba"

edit database ORDG set state='APPLY-OFF';

In my case, I am using wallets for ZDL, so, don’t forget to create the wallet path on data guard. This will avoid an issue during the process, because, the RMAN configuration will be synced with primary controlfile.

Connect with oracle user on data guard server and create directory primary wallet path:

mkdir -p /u01/app/oracle/wallets/zdl/orcl

Then, copy the wallets from primary to data guard.

scp /u01/app/oracle/wallets/zdl/orcl/* orasrvdg:/u01/app/oracle/wallets/zdl/orcl/

Connected with RMAN to the target standby, using a local connection, an administrator user, or a user with SYSBACKUP privileges, execute the recovery command below:

rman target /

RECOVER STANDBY DATABASE FROM SERVICE ORCL;

For Active Data Guard only, execute the following commands in SQL*Plus, connected to the ADG.

sqlplus sys as sysdba

ALTER DATABASE OPEN READ ONLY;

Check alert log for redo log groups that need be cleaned.

sqlplus /as sysdba

select * from v$standby_log;

Clear the redo log groups.

ALTER DATABASE CLEAR LOGFILE GROUP 7;
ALTER DATABASE CLEAR LOGFILE GROUP 8;
ALTER DATABASE CLEAR LOGFILE GROUP 9;
ALTER DATABASE CLEAR LOGFILE GROUP 10;
ALTER DATABASE CLEAR LOGFILE GROUP 11;
ALTER DATABASE CLEAR LOGFILE GROUP 12;
ALTER DATABASE CLEAR LOGFILE GROUP 13;
ALTER DATABASE CLEAR LOGFILE GROUP 14;

Start the synchronization process.

dgmgrl "/as sysdba"

edit database ORDG set state='APPLY-ON';

Deixe um comentário