Friday, October 8, 2010

Data Guard Switchover & Failover (manually)

Data Guard Switchover

On the primary

select database_role,switchover_status from v$database;
alter database commit to switchover to physical standby;


On the standby

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
On the primary
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;


On the standby

Oracle Database 10g release 1
SQL>SHUTDOWN IMMEDIATE;
SQL>STARTUP;


Oracle Database 10g release 2 onwards
SQL>ALTER DATABASE OPEN;


On the primary
alter database recover managed standby database disconnect from session;


Data Guard Failover


ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH FORCE;
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
ALTER DATABASE OPEN;


If the physical standby database has been opened in read-only mode since the last time it was started, shut down the target standby database and restart it:


SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP;