We understood roles of the database in the previous article and explored SwitchOver of database roles.
In this article, we will see FailOver of the Database role.
When we have planned maintenance activity we can simply switch roles of Primary and Standby database. But what if Primary Database crashes and we can’t recover it in a time.
Data Guard has a solution for that. We can Fail Over Primary database role to Standby Database and we don’t need to switch Standby Database role to Primary Database.
Types Of Failover :
There are mainly two types of Fail Over possible in Data Guard.
1.Manual FailOver: In manual Fail Over we need Manual Intervene of Database Administrator. In manual failover, we can perform Complete Failover and Immediate Failover.
In the complete FailOver, it attempts to minimize data loss by applying all redo log generated on Primary Database will be applied to a standby database.
This is the default method of failover.
In immediate failover, no additional data is applied on a standby database. This is fastest and we need to explicitly define this.
2. Fast-start FailOver: We need to configure this in data guard broker. So when Primary Database is unavailable. Dgbroker will fail over primary database role to One of standby database configured previously in dgbroker.
Failover Considerations: Things we need to take care while using this option.
In this option old primary database will be disabled from the Data Guard configuration.
If primary database crashed and generated archived not copied to standby database then data loss is possible.
This option is critical and should only be used in EMERGENCY.
Note: To use this option we should use Standby Database is most current[Maximum synchronized]
Performing failover :
Step 1: Check Standby Database role.
SQL> select name,open_mode,database_role from v$database; NAME OPEN_MODE DATABASE_ROLE --------- -------------------- ---------------- MYTEST MOUNTED PHYSICAL STANDBY
Step 2: Apply the following command to finish database recovery.
SQL> alter database recover managed standby database finish; Database altered.
Step 3: Use the following command to activate standby database to a primary.
SQL> alter database activate standby database; Database altered.
Step 4: Check open mode and database role from a v$database.
SQL> select name,open_mode,database_role from v$database; NAME OPEN_MODE DATABASE_ROLE --------- -------------------- ---------------- MYTEST MOUNTED PRIMARY
Step 5: Shut down primary database.
SQL> shut immediate; ORA-01109: database not open Database dismounted. ORACLE instance shut down.
Step 6: Startup database :
SQL> startup ORACLE instance started. Total System Global Area 521936896 bytes Fixed Size 2254824 bytes Variable Size 377489432 bytes Database Buffers 138412032 bytes Redo Buffers 3780608 bytes Database mounted. Database opened.
Step 7: Check open mode and database role from the v$database.
SQL> select name,open_mode,database_role from v$database; NAME OPEN_MODE DATABASE_ROLE --------- -------------------- ---------------- MYTEST READ WRITE PRIMARY
Stay tuned for More articles on Oracle DataGuard
Thank you for giving your valuable time to read the above information.
If you want to be updated with all our articles send us the Invitation or Follow us:
Telegram Channel: https://t.me/helporacle
Skant Gupta’s LinkedIn: www.linkedin.com/in/skantali/
Joel Perez’s LinkedIn: Joel Perez’s Profile
LinkedIn Group: Oracle Cloud DBAAS
Facebook Page: OracleHelp