12C Data Guard Switchover Best Practices Using Sqlplus
12C Data Guard Switchover Best Practices Using Sqlplus
I. Pre-Switchover check
Verify that the target standby is ready for switchover.
Checks ORL status on target standby.
What to do?
Verify Primary and Standby tempfiles match
NOTE : For multiple Standby environment make sure all the standby in SYNC with primary.
Check if log_archive_Dest(remote redo transport) set on Standby side
If switchover_status(v$database) shows UNRESOLVABLE GAP in RAC/non RAC
environment
II SWITCHOVER
Enable tracing on both primary and standby to diagnose in case of any issue.
Tail Alert Logs (optional) on all instances
Switchover the standby database to a primary
Open the new primary database
Restart the new standby
III. Post - Switchover Check
Set Trace to Prior Value
Verify that the new primary shipping logs to standby and standby is applying.
For the purposes of this document, the following fictitious environment is used as an
example to describe the procedure:
**********
I. Pre-Switchover check
Verify that the target standby is synchronous with primary and Redo shipping working fine from
primary.
For example,
ERROR at line 1:
ORA-16475: succeeded with warnings, check alert log for more details
SWITCHOVER VERIFY WARNING: switchover target has dirty online redo logfiles that require
clearing.
It takes time to clear online redo logfiles. This may slow down switchover process.
What to do?
NOTE: If not set set the value for example if directory structure changing only in
db_unique_name. for example,
NOTE: Restart the standby and start the MRP. When you restart standby and start MRP then it
clears all the ORLs at standby provided log_file_name_convert set properly.
Database altered.
Tempfiles created after standby creation will not be propagated to standby. Check the TEMP files
using below query and add new TEMP files at standby is required.
NOTE : For multiple Standby environment make sure all the standby in SYNC with primary.
SQL> select
status,DEST_ID,TYPE,ERROR,GAP_STATUS,SYNCHRONIZED,SYNCHRONIZATION_STATUS,RECOV
ERY_MODE from V$ARCHIVE_DEST_STATUS where STatus <> 'INACTIVE';
SQL>show parameter log_Archive_dest
II SWITCHOVER
Enable tracing on both primary and standby to diagnose in case of any issue.
* NOTE : In RAC environment no need to shutdown all instances apart from one instanc.
Switchover(SQLPLUS) comand itself shutdown all the nodes.
Primary-Boston,
Database altered.
.
NOTE: At standby side we wait only for 15 minutes for the standby to synchronous with primary.
SQL>shut abort
SQL>startup
The scenario worked, but after switchover completed, the Database Role in the OCR is not
changed automatically.
We need use [srvctl modify database] to change Database Role in the OCR according to real
database role.
for new primary:
#sqlplus / as sysdba
SQL> select DB_UNIQUE_NAME,DATABASE_ROLE from v$database;
DB_UNIQUE_NAME DATABASE_ROLE
------------------------------
chicago PRIMARY
#sqlplus / as sysdba
SQL> select DB_UNIQUE_NAME,DATABASE_ROLE from v$database;
DB_UNIQUE_NAME DATABASE_ROLE
------------------------------
boston PHYSICAL STANDBY
System altered.
Verify that the new primary shipping logs to standby and standby is applying.
@primary,
@standby,
NOTE : For Oracle version 12.2 use v$dataguard_process instead of v$managed_standby which is
deprecated in Oracle 12.2