Usually switchover comes in handy for maintenance activities. It’s also need a standard operating procedure to do the switchover of a critical database.
Pre-requisites before switch over: (assuming databases are configures for switchover)
— No lag.
— No active sessions.
— Shutdown other instances in both primary and standby.
— Service role changes before switchover (RAC)
Select * from v$dataguard_stats; — on standby to find the lag
Select name, switchover_status, database_role from v$database; — On primary
switchover_status mush to TO STANDBY, that means DB is ready for switchover.
On Primary:
— alter system switch logfile; or alter system archive log current; (in RAC).
— Shutdown the all other instances except one.
— alter database commit to switchover to pysical standby with session shutdown;
— shutdown and startup nomount;
— alter database mount standby database;
Now Come to standby db>
On Standby:
— Bring down other instances except one.
— alter database commit to switchover to primary with session shutdown;
— shutdown
— startup — This will bring up in normal mode.
— start the services
— This is the new primary database.
Now come to old primary:
— alter database recover managed standby database disconnect session;
** Do pre and post checks of services, and status on both primary and standby environments.