Data Guard

How to Change the Apply Instance on a Standby RAC Database

If you have not assign a preferred apply instance in the broker configuration in advance, the broker will choose one of running instances randomly to play the role. Let’s see the current status of our standby RAC database, in our case, instance standb2 starts up early than standb1.
$ srvctl status database -d compdb
Instance standb1 is not running on node standby01
Instance standb2 is running on node standby02
$ srvctl status database -d compdb
Instance standb1 is running on node standby01
Instance standb2 is running on node standby02


As you expected, the broker choose standb2 to be the apply instance as following.
DGMGRL> show database standb

Database - standb

  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   0 seconds
  Apply Lag:       0 seconds
  Real Time Query: OFF
  Instance(s):
    standb1
    standb2 (apply instance)

Database Status:
SUCCESS

Have the database ever been assigned a preferred apply instance? Obviously not, but we can check the property for sure:
DGMGRL> show database standb 'PreferredApplyInstance';
  PreferredApplyInstance = ''

It’s an empty value, and no surprise that the broker will choose the first running instance to do the applying job.

Since the random apply instance is not predictable and we planned to ask OP for monitoring the applying process always on a specific instance, so we have to fix on a preferred apply instance instead of an unpredictable way. We can do it in one statement and take effect right away and it will be persistent in the broker configuration.
DGMGRL> edit database standb set state='APPLY-ON' with apply instance='standb1';
Succeeded.
DGMGRL> show database standb

Database - standb

  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   0 seconds
  Apply Lag:       0 seconds
  Real Time Query: OFF
  Instance(s):
    standb1 (apply instance)
    standb2

Database Status:
SUCCESS

DGMGRL> show database standb 'PreferredApplyInstance';
  PreferredApplyInstance = 'standb1'

The apply instance is now standb1.

Leave a Reply

Your email address will not be published. Required fields are marked *