Monday, 11 January 2016

Dataguard - Failover and Switchover



Switch-over is the planned role change.It does not require re-installation of a new database. It can be used to test interoperability of  standby database, OS and hardware maintenance. 

Fail-over is the deformation of the production (primary) database and activating standby database as the primary.It is not reversible. When enabled, re-create the standby database.

SWITCH-OVER:

SWITCHOVER is the planned role change. So, Primary database will operate as standby and standby will operate as primary database. Which is useful for testing and to do maintenance work in production (primary) database, etc.

QUICK GUIDE

old primary site
SQL>select switchover_status from v$database;
SQL>alter database commit to switchover to physical standby with session shutdown;
SQL>shutdown immediate
SQL>startup nomount
SQL>alter database mount standby database;
SQL>alter system set log_archive_dest_state_2=defer;
old standby site
SQL>select switchover_status from v$database;
SQL>alter database commit to switchover to primary;
SQL>shutdown immediate
SQL>startup
old primary site
SQL>recover managed standby database disconnect

SQL>alter system set log_archive_dest_state_2=enable;


STEP-1: On Primary.

Switch log file on primary database.

SQL> alter system switch logfile;

STEP-2: On Primary

Check switchover status before switching database from primary to standby on primary.

SQL> select switchover_status from v$database;

You must see "TO_STANDBY" as result.

STEP-3: On Primary

Switch primary database to standby database.

SQL> alter database commit to switchover to physical standby with session shutdown;
SQL> shutdown immediate;
SQL> startup nomount;
SQL> alter database mount standby database;

STEP-4: On Primary

Defer for archive log apply. Because i didnt set my standby database a primary yet.

SQL> alter system set log_archive_dest_state_2=defer;

STEP-5: On Standby

Switch standby database to primary. Check switchover status berfore switching database on standby database.

SQL> select switchover_status from v$database;

You must see "TO_PRIMARY" as result. Now lets swtich

alter database commit to switchover to primary;
shutdown immediate;
startup;

Our switchover process is successfully completed.

STEP-6: On Primary

Start real-time recovery process.

recover managed standby database using current logfile disconnect;

Finally lets open our database with "Read-only with apply".

recover managed standby database cancle;

alter database open;

recover managed standby database using current logfile disconnect;


@@ All the best...!!! :)

FAIL-OVER:


No comments:

Post a Comment