How to Change Apply Instance in Oracle Data Guard RAC Standby Using DGMGRL

 

If you're running Oracle Data Guard in a RAC (Real Application Clusters) environment, you likely have a standby database with multiple instances. In such a setup, only one instance is responsible for applying redo logs — this is called the apply instance.

Sometimes, you may need to change the apply instance — for example, due to load balancing, maintenance, or an ORA-16789: standby apply not running error.

Let's see how to change the apply instance in Data Guard using dgmgrl, the Oracle Data Guard Broker command-line tool.

What is the Apply Instance in Oracle Data Guard?

 In Oracle Data Guard, the Apply Instance refers to the instance responsible for applying redo logs to the standby database. This process ensures that the standby database remains synchronized with the primary database by continuously applying changes recorded in the redo logs.

Let's see the current configuration.

DGMGRL> show configuration

Configuration - broker_config

Protection Mode: MaxPerformance Databases: ORCL - Primary database ORCLSBY - Physical standby database Fast-Start Failover: DISABLED Configuration Status:
SUCCESS

 Check Current Apply Instance

DGMGRL> show database 'ORCLSBY'

Database - ORCLSBY

Role: PHYSICAL STANDBY Intended State: APPLY-ON Transport Lag: 0 seconds Apply Lag: 0 seconds Real Time Query: ON Instance(s): ORCLSBY1 ORCLSBY2 (apply instance) Database Status:
SUCCESS

Current apply instance is ORCLSBY2 as seen above. To change it to ORCLSBY1 disable apply temporarily, set a new apply Instance and enable apply again

DGMGRL> edit database 'ORCLSBY' set state='apply-off';
Succeeded.
DGMGRL> show database 'ORCLSBY'

Database - ORCLSBY Role: PHYSICAL STANDBY Intended State: APPLY-OFF Transport Lag: 0 seconds Apply Lag: 0 seconds Real Time Query: OFF Instance(s): ORCLSBY OCRLSBY (apply instance) Database Status: SUCCESS DGMGRL> edit database 'ORCLSBY' set state='apply-on' with apply instance ='ORCLSBY1';
Succeeded.

Lets verify the configuration now.

DGMGRL> show database 'ORCLSBY'

Database - ORCLSBY

Role: PHYSICAL STANDBY Intended State: APPLY-ON Transport Lag: 0 seconds Apply Lag: 0 seconds Real Time Query: ON Instance(s): ORCLSBY1 (apply instance) ORCLSBY2 Database Status: SUCCESS DGMGRL> show configuration Configuration - broker_config Protection Mode: MaxPerformance Databases: ORCL - Primary database ORCLSBY - Physical standby database Fast-Start Failover: DISABLED Configuration Status:
SUCCESS

Now you'll see Current Apply Instance: ORCLSBY1

Comments