In dataguard setup, we can make primary database as physical standby database and standby as primary . This is known as switch over.
TEST1 – Primary
Before doing switchover, we have to make sure that the existing standby setup is fine and the archives are getting shipped and applied properly on standby.
Check the lag between primary and standby
select LOG_ARCHIVED-LOG_APPLIED "LOG_GAP" from (SELECT MAX(SEQUENCE#) LOG_ARCHIVED FROM V$ARCHIVED_LOG WHERE DEST_ID=1 AND ARCHIVED='YES'), (SELECT MAX(SEQUENCE#) LOG_APPLIED FROM V$ARCHIVED_LOG WHERE DEST_ID=2 AND APPLIED='YES');
Also check : How to monitor physical standby setup:
switch some logfile and check whether logs are getting applied in standy or not
PRIMARY> alter system switch logfile; altered.
switchover primary to standby
TEST1> alter database commit to switchover to physical standby with session shutdown; database altered.
switchover standby to primary:
TEST2>alter database commit to switchover to primary; database altered.
shutdown both primary and standby:
TEST1> shutdown immediate; TEST2> shutdown immediate;
Now TEST1 will be standby and TEST2 primary
startup the new primary[TEST2]
TEST2> startup mount TEST2> alter database open; database altered.
Mount the new standby and start recovery:
TEST1>startup mount TEST1>alter database recover managed standby database disconnect from session; database altered.
Now switch some logs in primary and check whether redos are getting applied or not.
TEST2> ALTER SYSTEM SWITCH LOGFILE; altered / / / altered altered