In this article, we are going to explain Oracle standby database switchover and switchback steps.
For any firm, business continuity (disaster recovery) has become a key component. There is usually a primary and secondary (standby) site when installing a DR system – and in some situations more than one secondary site to give extra security.
Switchover may be thought of as a well-orchestrated procedure for switching duties between the primary and secondary (standby) sites. It’s done in a controlled manner, and the key is that no data is lost in the process.
Yes, there is normally downtime associated with this procedure, however, it occurs over a predetermined period of time. You will be aware of how long this procedure takes.
Once the backup database is established and working well, we may swap to it for testing purposes to decrease the downtime of the primary database. For a variety of reasons, such as OS upgrades, hardware upgrades, and other difficulties, the primary database may require downtime.
There is no data loss when we transition from the primary database to the standby database. We may switch back to the standby database after the primary database maintenance is completed.
We’re getting ready for the switchover and will really do it.
Table of Contents
Oracle Data Guard has two primary database roles:
- Primary Database
- Standby Database
These two functions are incompatible. The primary role deals with all of the connections that come in from the end-user. In contrast, the Standby role is exclusively linked to the Primary Database. Whatever work is being done on the primary database will be redo data on standby.
The Standby database’s MRP or LSP procedure will apply the redo in the Standby database.
Following are the steps for Oracle Database Switchover:
Production Side:
Step 1: Determine whether or not a switchover is doable.
SQL>select switchover_status from v$database;
SWITCHOVER_STATUS
——————–
TO STANDBY
The value TO STANDBY in the “switchover status” field revealed that the main database may be switched to the standby role. If the TO STANDBY value is not shown, double-check that the setup is working properly.
Step 2: Start the switchover process by executing the below command:
SQL>alter database commit to switchover to physical standby with session shutdown;
By shutting the main database, the preceding statement first stops all current sessions. Then any redo log files that haven’t been archived are transferred and applied to the standby database. Aside from that, the header of the final log file preserved is marked with an end-of-redo indication. The current control file is produced as a backup, and the current control file is transformed into a standby control file.
Step 3: Shut down and restart the primary instance.
SQL>shutdown immediate;
SQL>startup mount;
Old DataGuard Side:
Step 4: Determine whether or not a switchover is doable.
SQL>select switchover_status from v$database;
SWITCHOVER_STATUS
——————–
TO PRIMARY
Step 5: Issue the switchover command:
SQL>alter database commit to switchover to primary;
Step 6: open the new production database.
SQL>alter database open;
On the new DataGaurd Side:
Step 7: Open new DataGaurd in the physical standby mode:
SQL>alter database recover managed standby database disconnect from session;
The same method may be used to move between single and multiple data guard configurations.