Friday, August 15, 2008

Manual Dataguard Switchover

# primary
# first shutdown the second RAC node
select database_role from v$database;
SELECT SWITCHOVER_STATUS FROM V$DATABASE;
ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;

# standby
select database_role from v$database;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
SELECT SWITCHOVER_STATUS FROM V$DATABASE;
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WAIT WITH SESSION SHUTDOWN;
shutdown immediate;
startup;

# old primary
shutdown immediate;
startup;
select database_role from v$database;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;