Performing a failover using the Data Guard broker in Oracle 19c is crucial for ensuring system availability and maintaining data integrity during unplanned outages. This tutorial will guide you through executing a failover in Data Guard using the broker. The failover process allows the standby database to transition to the primary role, ensuring continuity of operations. This operation is critical in disaster recovery scenarios.
Types of Data Guard Failover
Manual Failover
Manual failover is performed by the DBA and includes two types:
Complete Failover using broker
- Attempts to minimize data loss by applying all available redo data on the standby, depending on the protection mode.
- This type of failover avoids disabling any standby databases that are not the failover target.
- It is the default and recommended type of failover.
Immediate Failover
- No additional redo data is applied on the standby.
- This is a faster failover method.
- Requires recreating all standbys that were not the failover target, including the former primary.
DGMGRL> failover to 'standby' IMMEDIATE;
Fast-Start Failover
Fast-start failover is automatically performed by the Data Guard Broker.
- Requires enabling Flashback and configuring the Fast Recovery Area on both primary and standby to use fast-start failover.
Environment Details
SELECT flashback_on, instance_name, database_role FROM database_instance;
FLASHBACK_ON INSTANCE_NAME DATABASE_ROLE
YES primary_instance PRIMARY
SELECT flashback_on, instance_name, database_role FROM database_instance;
FLASHBACK_ON INSTANCE_NAME DATABASE_ROLE
YES standby_instance PHYSICAL STANDBY
Note: Now the primary database is PrimaryInstance. After the failover, the primary database will be StandbyInstance.
Steps to Perform a Failover Using Broker
Step 1: Show the Configuration
dgmgrl
DGMGRL> connect sys/password@primary_instance
Connected to "primary_instance"
Connected as SYSDBA.
Step 2: Verify the Configuration
Issue the SHOW CONFIGURATION command to verify the failover setup.
DGMGRL> SHOW CONFIGURATION;
Configuration - config_name
Protection Mode: MaxAvailability
Members:
primary_instance - Primary database
standby_instance - Physical standby database
Fast-Start Failover: Disabled
Configuration Status: SUCCESS (status updated 57 seconds ago)
Step 3: Validate the Target Standby
Failover using broker – To validate the target standby database to ensure it’s ready to become the new primary database, use the VALIDATE DATABASE command.
DGMGRL> VALIDATE DATABASE 'standby_instance';
Database Role: Physical standby database
Primary Database: primary_instance
Ready for Switchover: Yes
Ready for Failover: Yes (Primary Running)
Managed by Clusterware:
primary_instance: NO
standby_instance: NO
Validating static connect identifier for the primary database primary_instance…
The static connect identifier allows for a connection to database "primary_instance".
Current Log File Groups Configuration:
Thread # Online Redo Log Groups Standby Redo Log Groups Status
(primary_instance) (standby_instance)
1 3 3 Insufficient SRLs
Step 4: Connect to the Target Standby Database
dgmgrl
DGMGRL> connect sys/password@standby_instance
Connected to "standby_instance"
Connected as SYSDBA.
Step 5: Perform the Failover
Now you can issue the failover using broker command to make the target standby database the new primary database for the configuration.
DGMGRL> failover to 'standby_instance';
Performing failover NOW, please wait…
Failover succeeded, new primary is "standby_instance"
Step 6: Verify the Configuration Post-Failover
dgmgrl
DGMGRL> connect sys/password@standby_instance
Connected to "standby_instance"
Connected as SYSDBA.
DGMGRL> SHOW CONFIGURATION;
Configuration - config_name
Protection Mode: MaxAvailability
Members:
standby_instance - Primary database
primary_instance - Physical standby database (disabled)
Fast-Start Failover: Disabled
Configuration Status: WARNING (status updated 21 seconds ago)
ORA-16661: the standby database needs to be reinstated
Successfully completed the failover using Oracle 19c with Broker DGMGRL Utility.
Conclusion
Performing a Data Guard failover using the broker is a critical operation that ensures the continuity and availability of your database systems during unplanned outages. By following this tutorial, we have outlined the necessary steps to prepare, execute, and verify the failover process. Properly configuring the standby database and ensuring it is ready for failover is crucial. This guide simplifies the process, allowing for seamless role transitions and maintaining data integrity throughout.
See more on Oracle’s website!
Be Oracle Dataguard Certified Professional, this world is full of opportunities for qualified DBAs!