Thursday, July 16, 2009

Manual Dataguard Switchover

# primary
# first shutdown the second RAC node
SELECT SWITCHOVER_STATUS FROM V$DATABASE; -- result should be either TO STANDBY if nothing is running or SESSIONS ACTIVE if there are connected sessions
ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;

# standby
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
SELECT SWITCHOVER_STATUS FROM V$DATABASE; -- result should be TO PRIMARY
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WAIT WITH SESSION SHUTDOWN;
STARTUP MOUNT FORCE;
ALTER DATABASE OPEN;

# old primary
STARTUP MOUNT FORCE;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;