1. Dataguard Primary and Standby switching
1.1. Check if the current master repository has switching conditions
SelectSequence#,first_time,next_time,archived,applied fromV$archived_logwheresequence#=(Select Max(sequence#) fromV$archived_log); sequence# first_time next_time Archived applied------------------------------------------------------------------------------------ Wuyi .- --Geneva A:xx: A .- --Geneva -:Geneva: -YESin-MEMORYSelectSequence#,first_time,next_time,archived,applied fromV$archived_logwheresequence#=(Select Max(sequence#) fromV$archived_log); sequence# first_time next_time Archived applied---------- ------------------- ------------------- --------- --------------------------- Wuyi .- --Geneva A:xx: A .- --Geneva -:Geneva: -YESin-MEMORYSelectProcess,sequence#,status fromV$managed_standby; PROCESS sequence# STATUS--------------------------- ---------- ------------------------------------ARCH -Closingarch -Closingarch0ConnectedarchWuyiClosingrfs0Idlerfs theIdlerfs0IDLEMRP0 theApplying_log
SelectSequence#,status fromv$Log Order bysequence#; sequence# STATUS---------- ------------------------------------------------ -INACTIVEWuyiINACTIVE the Currentcolumndatabase_role Format A20columnopen_mode Format A15columnprotection_mode Format A20columnswitchover_status Format A20SelectDatabase_role,open_mode,protection_mode,switchover_status fromv$Database;D atabase_role open_mode protection_mode switchover_status-------------------- --------------- -------------------- --------------------PRIMARY READWRITE MAXIMUM Performance toSTANDBY
1.2. Converting the main library to a standby library
Alter Database Commit toSwitchover toPhysical standby withSessionshutdown; startup Mount;Alter DatabaseRecover managed StandbyDatabaseUsing CurrentLogFile Disconnect fromsession;SelectDatabase_role,open_mode,protection_mode,switchover_status fromv$Database;D atabase_role open_mode protection_mode switchover_status-------------------- --------------- -------------------- --------------------Physical STANDBY mounted MAXIMUM performance to PRIMARY
1.3. Converting a standby library to a master library
columndatabase_role Format A20columnopen_mode Format A15columnprotection_mode Format A20columnswitchover_status Format A20SelectDatabase_role,open_mode,protection_mode,switchover_status fromv$Database;D atabase_role open_mode protection_mode switchover_status-------------------- --------------- -------------------- --------------------Physical STANDBY mounted MAXIMUM performance to PRIMARYAlter Database Commit toSwitchover to Primary;Alter Database Open;SelectDatabase_role,open_mode,protection_mode,switchover_status fromv$Database;D atabase_role open_mode protection_mode switchover_status-------------------- --------------- -------------------- --------------------PRIMARY READWRITE MAXIMUM Performance toSTANDBY
1.4. Test the primary and standby data synchronization status
SelectSequence#,first_time,next_time,archived,applied fromV$archived_logwheresequence#=(Select Max(sequence#) fromV$archived_log); sequence# first_time next_time Archived applied---------- ------------------- ------------------- --------- --------------------------- Wu .- -- to Geneva: -: the .- -- to Geneva: -: +YES NO Wu .- -- to Geneva: -: the .- -- to Geneva: -: +Yes YesAlterSystem ArchiveLog Current;AlterSystem ArchiveLog Current;SelectSequence#,first_time,next_time,archived,applied fromV$archived_logwheresequence#=(Select Max(sequence#) fromV$archived_log); sequence# first_time next_time Archived applied---------- ------------------- ------------------- --------- --------------------------- About .- -- to Geneva: +: on .- -- to Geneva: +:GenevaYES NO About .- -- to Geneva: +: on .- -- to Geneva: +:GenevaYES NO
SelectSequence#,first_time,next_time,archived,applied fromV$archived_logwheresequence#=(Select Max(sequence#) fromV$archived_log); sequence# first_time next_time Archived applied---------- ------------------- ------------------- --------- --------------------------- About .- -- to Geneva: +: on .- -- to Geneva: +:GenevaYESin-MEMORY
2. Dataguard failover
2.1. Premise: The main library has been hung off
2.2. Casting the repository to the master library
2.3. Rebuilding the Standby Library
Oracle 11.2.0.4.0 Dataguard Deployment and routine maintenance (5)-datauard Primary and Standby switchover and failover chapter