Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Oracle Dataguard switch Over & Fail Over

ROLE TRANSMISSION IN DATAGUARD :
Data Guard uses two terms when cutting over the standby server, switch-over which is a planned and failover which a unplanned event
SWITCH OVER:
A database can be in one of two mutually exclusive modes (primary or standby). These roles can be altered at runtime without loss of data or resetting of redo logs. This process is known as a Switchover and can be performed using the following statements. 
1.PREREQUISTS
SQL>select process, operation, r.status, mbytes_processed pct, s.status from v$rman_status r, v$session s where r.sid=s.sid;(show any running jobs or backup)
SQL>select client_process, process, sequence#, status from v$managed_standby;(check that redo has been applied)
SQL>alter system switch logfile; (Switch log file on primary database) 
2.Check switchover status before switching database.
SQL>select switchover_status from v$database; 
 You must see “TO_STANDBY” as result.
3.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; 
4.Defer for archive log apply. Because I didn’t set  my standby database as primary yet.
SQL>alter system set log_archive_dest_state_2=defer; 
5.Switch standby database to primary. Check switchover status before switching database.
SQL>select switchover_status from v$database; 
You must see “TO_PRIMARY” as result. Now let’s swtich
6.Switch primary database to standby database.
SQL>alter database commit to switchover to primary;
SQL>shutdown immediate;
SQL>startup; 
Our switchover process is successfully completed .
7. Start real-time recovery process..
SQL>recover managed standby database using current logfile disconnect;
Finally let’s open our database with “Read Only with Apply”.

SQL>recover managed standby database cancel;
SQL>alter database open;
SQL>recover managed standby database using current logfile disconnect;

FAIL OVER:
If the primary database is not available the standby database can be activated as a primary database using the following statements.
1.PREREQUISTS
SQL> SELECT UNIQUE THREAD# AS THREAD, MAX(SEQUENCE#) OVER (PARTITION BY thread#) AS LAST from V$ARCHIVED_LOG;
SQL> SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;
2.Stop the redo apply process in standby database.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
3.Finish to apply archive logs copied from primary.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;
SQL> ALTER DATABASE ACTIVATE PHYSICAL STANDBY DATABASE;
In this situation you can open database .If you get no error, continue the below step.
4.Switch standby database to primary database.
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;
5.Open database.
SQL> ALTER DATABASE OPEN;

SQL>SHUTDOWN IMMEDIATE;
SQL>TARTUP MOUNT;
SQL>ALTER DATABASE OPEN READ ONLY;
SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
The following operations are disallowed
(i)Any Data Manipulation Language (DML) except for select statements
(ii)Any Data Definition Language (DDL)
(iii)Access of local sequences
(iv)DMLs on local temporary tables

Comments

Popular posts from this blog

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

PostgreSQL Pgbadger Installation On Linux

PostgreSQL pgBadger

How to configure Replication Manager (repmgr) ?

Migrating From Oracle to PostgreSQL using ora2pg open source tools