Data Guard Failover Operation
Published by : Obay Salah , November 19, 2024
To bring one of the standby databases as the new primary database and perform a failover, especially in the case of a catastrophic failure in the primary database where it cannot be restored in a timely manner, the problematic primary database is ignored, and the target standby database takes on the role of the new primary database.
Failover is performed on the standby database that will become the new primary database. After the failover is complete, the standby database will assume the role of the primary database, while the original primary database cannot be used as a standby database unless it is recreated or restored using Flashback Database. Therefore, it is recommended to enable Flashback Database on both the primary and standby databases.
Here are the steps to execute a failover:
Failover Execution Steps:
1. Connect to the Target Standby Database
sql Copy code DGMGRL> CONNECT sys/sys@STANNET Connected.
2. Execute the Failover Command
sql Copy code DGMGRL> FAILOVER TO "STAN"; Performing failover NOW. Please wait... Operation requires shutdown of instance "STAN" on database "STAN". Shutting down instance "STAN"... database not mounted ORACLE instance shut down. Operation requires startup of instance "STAN" on database "STAN". Starting instance "STAN"... ORACLE instance started. Database mounted. Failover succeeded. New primary is "STAN"
3. Confirm Failover Success
sql Copy code DGMGRL> SHOW CONFIGURATION; Configuration Name: TEST Enabled: YES Protection Mode: MaxPerformance Databases: PRIM - Physical standby database STAN - Primary database Current status for "TEST": SUCCESS
4. Verify the Original Primary Database
sql Copy code DGMGRL> SHOW DATABASE 'PRIM'; Database Name: PRIM Role: PHYSICAL STANDBY Enabled: NO Intended State: ONLINE Instance(s): PRIM Current status for "PRIM": Error: ORA-16795: Database resource guard detects that database reinstantiation is required
Notice that the Data Guard Broker has disabled the old primary database.
Data Guard Broker Commands
Oracle Data Guard provides a set of commands to manage and monitor databases. You can view the available commands using the HELP
command:
sql Copy code DGMGRL> HELP The following commands are available: Add: Add a standby database into the broker configuration Connect: Connect to an Oracle instance Create: Create a broker configuration Disable: Disable broker control of a configuration or database Edit: Edit a configuration, database, or instance Enable: Enable broker control of a configuration or database Exit: Exit the program Failover: Change a standby database to be the primary database Help: Display description and syntax for a given command Quit: Exit the program Rem: Comment to be ignored by DGMGRL Remove: Remove a configuration, database, or instance Show: Display information of a configuration, database, or instance Shutdown: Shut down a currently running Oracle instance Startup: Start an Oracle database instance Switchover: Switch roles between the primary database and a standby database
To learn the syntax for a specific command, use HELP
followed by the command name:
sql Copy code DGMGRL> HELP CREATE Create a broker configuration Syntax: CREATE CONFIGURATION <configuration_name> AS PRIMARY DATABASE IS <database_name> CONNECT IDENTIFIER IS <connect_identifier>;
By following these steps and commands, you can efficiently manage the failover process and handle the database roles in Oracle Data Guard.
Comments
no comment yet!