12c Data Guard Switchover Best Practices Using SQLPLUS
12c Data Guard Switchover Best Practices Using SQLPLUS
1578787.1)
To
Bottom
In this Document
Goal
*** Reviewed for Relevance 16-Jul-2015 ***
This Document describs step by step method to perform switchover on Physical Standby
Environment using SQLPLUS.
Solution
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.
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
SOLUTION
I. Pre-Switchover check
Verify that the target standby is ready for switchover.
Verify that the target standby is synchronous with primary and Redo shipping working fine from
primary.
SQL>alter database switchover to <target standby db_unique_name> verify;
The above command will verify following things,
a. Verifies that the release version is minimum 12.1
b. Primary REDO shipping.
c. Standby MRP recovery running and its synchronous with primary, else it will through below
error in SQLPROMPT and alert log as well.
For example,
SQL>alter database switchover to chicago verify;
ORA-16470: Redo Apply is not running on switchover target
ERROR at line 1:
ORA-16475: succeeded with warnings, check alert log for more
details
-----Primary Alert log----------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?
Make sure log_file_name_convert set properly on target standby.
SQL>show parameter log_file_name_convert;
NOTE: If not set set the value for example if directory structure changing only in
db_uniquq_name. for example,
Primary ORL location is /oradata/boston/<>
Standby logfile location is /oradata/chicago/logfiles>
Set the parameter like,
alter system set LOG_FILE_NAME_CONVERT=boston,chicago scope=spfile;
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.
If Standby is synchronous with primary, we will get below messages,
SQL> alter database switchover to chicago verify;
Database altered.
II SWITCHOVER
Enable tracing on both primary and standby to diagnose in case of any issue.
SQL>alter system set log_archive_trace=8191 sid=*;
Tail Alert Logs (optional) on all instances
@primary and standby,
SQL>show parameter background_dump_dest
$tail -600f background_dump_dest/alert*
* NOTE : In RAC environment no need to shutdown all instances apart from one instanc.
Switchover(SQLPLUS) comand itself shutdown all the nodes.
NOTE: At standby side we wait only for 15 minutes for the standby to synchronous with
primary.
Open the new primary database
SQL>alter database open;
Restart the new standby
SQL>shut abort
SQL>startup
SQL>alter database recover managed standby database disconnect;
@standby,
SQL>select process,sequence#,thread#,status from
v$managed_standby;
SQL>select max(sequence#),thread# from v$archived_log group by
thread#;