Performing Switchover (Physical Standby Database) Step 0: Preparing For Switchover
Performing Switchover (Physical Standby Database) Step 0: Preparing For Switchover
switch logfile; SQL> alter system archive log current; Current Standby Database Disconnect the managed recovery mode in Standby Server. SQL> recover managed standby database cancel; Media recovery complete. SQL> recover standby database; AUTO SQL> exit Step 1: Verify switchover status SQL> Select switchover_status from V$Database; To standby Possible output To Standby: It is possible to switch the primary to standby database. Sessions Active: Identify and terminate active user or SQL sessions that might prevent a switchover from being processed. If, after performing these steps, the SWITCHOVER_STATUS column still displays SESSIONS ACTIVE, you can successfully perform a switchover by appending the WITH SESSION SHUTDOWN clause to the ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY statement; Not Allowed - Either this is a standby database and the primary database has not been switched first, or this is a primary database and there are no standby databases. Switchover Pending - This is a standby database and the primary database switchover request has been received but not processed. Switchover Latent - The switchover was in pending mode, but did not complete and went back to the primary database. To Primary - This is a standby database, with no active sessions, that is allowed to switch over to a primary database. Recovery Needed - This is a standby database that has not received the switchover request. Step 2: Change primary database to physical standby database role
SQL> Alter Database commit to switchover to physical standby [with session shutdown]; Step 3: Shutdown and restart the (original primary) database in the mount mode. SQL> Shutdown immediate; SQL> Startup nomount; SQL> Alter database mount standby database; At this stage both the databases are in standby mode. Step 4: Stop Log transport services on old primary database SQL> Alter system set log_archive_dest_state=defer; Step 5: Verify switchover status in the target standby database. SQL> Select switchover_status from V$Database; To Primary: Ready for switch over If the value is SESSIONS ACTIVE, identify and terminate active user or SQL sessions that might prevent a switchover from being processed. If, after performing these steps, the SWITCHOVER_STATUS column still displays SESSIONS ACTIVE, you can proceed to Step 5, and append the WITH SESSION SHUTDOWN clause to the switchover statement. Step 6: Switch the target standby database to primary role SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY [WITH SESSION SHUTDOWN]; Step 7: Open the new primary database. If the standby database has been opened in read only mode since it has started, SQL> Shutdown immediate; SQL> Startup; If the standby database has not been opened in read only mode since it has started, SQL> Alter Database Open; Note: There is no need to shut down and restart other standby databases (not involved in the switchover) that are online at the time of the switchover. These standby databases will continue to function normally after the switchover completes. Step 7: Enable Log Transport services on the new primary database. SQL> Alter system set log_archive_dest_state=enable;
Step 8: Check whether the redo data is send to the standby databases. SQL> Alter system switch logfile;