Configure fast-start failover with Oracle Data Guard Broker for HA
Check StaticConnectIdentifier: In order to enable FSFO, the StaticConnectIdentifier parameter must be set both in primary and standby
On primary(test):
===================
dgmgrl sys/sys@test
DGMGRL> show database test StaticConnectIdentifier;
DGMGRL> show database test_s StaticConnectIdentifier;If StaticConnectIdentifier is blank: The StaticConnectIdentifier takes its value from LOCAL_LISTENER parameter from the database. If this value is not set (or blank) for any database above, then connect to sqlplus and edit LOCAL_LISTENER parameter
SQL> ALTER SYSTEM SET LOCAL_LISTENER='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.204)(PORT=1521))';
Once you make changes to LOCAL_LISTENER parameter, you must restart the listener.
Note:----->>>the Above is required only if you have RAC and ASM environment since we are working on standalone database skip all the above steps
Define FastStartFailoverTarget: In general, there can be more than one physical standby database. So, we need to pair physical standby with primary to let Fast Start Failover know which physical standby to be activated
On primary (test):
====================
dgmgrl sys/sys@test
DGMGRL> SHOW FAST_START FAILOVER
DGMGRL> EDIT DATABASE test SET PROPERTY FastStartFailoverTarget = 'test_s';
DGMGRL> EDIT DATABASE test_s SET PROPERTY FastStartFailoverTarget = 'test';
DGMGRL> show database verbose test;
DGMGRL> show database verbose test_s;
Define FastStartFailoverThreshold: Next we need to let broker know when to initiate automatic failover. What is the time (in seconds) that FSFO will wait before initiating failover
DGMGRL> EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold=30;
DGMGRL> show fast_start failover
Define FastStartFailoverLagLimit: We can optionally define how much time (in seconds) data we are ready to lose in case the Data Guard is in Max Performance Mode
DGMGRL> EDIT CONFIGURATION SET PROPERTY FastStartFailoverLagLimit = 30;
Enable FSFO: Now we can enable FSFO. Never start observer on production database
On Standby Server:
==================
dgmgrl sys/sys@test_s
DGMGRL> ENABLE FAST_START FAILOVER;
DGMGRL> show configuration;
DGMGRL> start observer;
Test FSFO Configuration
Let us simulate a failure. We will abort primary (test) instance and wait for FSFO to perform automatic failover.
Simulate failure: On test, the current primary, let us shut abort the instance
On primary (test):
===================
sqlplus / as sysdb
SQL> shut abort;
Check logfiles: At this stage, check alert log and observer log files. FSFO must perform automatic failover and test_s would be your new primary database
check client connectivity.
SQL> select name, open_mode, db_unique_name from v$database;
On new primary (test_s):
===========================
sqlplus / as sysdba
SQL> select name, open_mode, db_unique_name from v$database;
Reinstate Failed Primary
Mount the failed primary (test) and it will auto reinstate.
Note: Do not open the database as it will be switched to physical standby
On failed primary (test):
===========================
sqlplus / as sysdba
SQL> startup mount;
dgmgrl sys/sys@test
DGMGRL> show configuration;
You can perform switchover to get back the original configuration
On current primary (test_s):
===============================
dgmgrl sys/sys@test_s
DGMGRL> show configuration;
DGMGRL> switchover to test;
Disable FSFO
dgmgrl sys/sys@test
DGMGRL> DISABLE FAST_START FAILOVER;
Stop observer:
==============
dgmgrl sys/sys@test_s
DGMGRL> stop observer;