Role switching of ORACLE DataGuard master and standby library
Reasons for switching between master and slave libraries: 1. Switch: active switching by users; 2. Failover: forced switching when the master database fails; switch switching process: first master database and then backup master library 1. Check switchover_status:select database_role, switchover_status from vault database; if switchover_status is: to standby, then: ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY otherwise use: ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN; 2. Restart the database: shutdown immediate; startup nomount; 3. Prepare mount alter database mount standby database; for library 1. Apply redo:alter database recover managed standby database disconnect from session; 2. Check switchover_status:select database_role, switchover_status from vault database; if switchover_status is: to primary, then: ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY otherwise use: ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN; 3. Restart the database shutdown immediate; startup; failover master and standby library switch 1. Stop log application
Alter database recover managed standby database cancel
two。 Turn off standby log transfer
Alter database recover managed standby database finish force
3. Switch to primary
When alter database commit to switchover to primary with session shutdown; makes this step, if there is a gap, it will report an ORA-16139:Switchover: Media recovery required-standby not in limbo error. When doing testing, this problem will occur if you start the main database and then prepare the database, and do not wait for the completion of the transfer of the logs related to the standby database. Forced switching is required at this time.
Alter database activate physical standby database; 4. Restart the database to the open state