How to use the Oracle Data Guard Switchover Operations

oracle dataguard

Dataguard Switchover is a planned role change. In other words, it is the transition of the live database to the standby role and the standby database to the live role. We may be doing Dataguard switchover for testing the functionality of our backup database, doing maintenance work in our live database, etc.Dataguard Switchover operation can be done with GUI interface such as Enterprise manager, Data Guard Broker or manually via sqlplus. In this article, I will use the manual switch method over sqlplus. In my following articles, Below, I will remind you with which server server we will run the commands before each operation step.

Also Click for Oracle Data Guard Gap problem.

Actions on the Current Primary Party

$ sqlplus / as sysdba

SQL> alter system switch logfile;

System altered.

SQL> select switchover_status, database_role from v$database;

SWITCHOVER_STATUS DATABASE_ROLE
—————————————————————-
TO STANDBY PRIMARY

SQL> alter database commit to switchover to physical standby with session shutdown;

Database altered.

SQL> shutdown immediate;
ORA-01092: ORACLE instance terminated. Disconnection forced

SQL> startup nomount
ORACLE instance started.

Total System Global Area 534462464 bytes
Fixed Size 2230072 bytes
Variable Size 171968712 bytes
Database Buffers 352321536 bytes
Redo Buffers 7942144 bytes
SQL>

SQL> alter database mount standby database;

Database altered.

SQL> alter system set log_archive_dest_state_2 = defer;

System altered.

Things to be done on the Secondary Party

$ sqlplus / as sysdba

SQL> select switchover_status, database_role from v $ database;

SQL> alter database commit to switchover to primary with session shutdown;

Database altered.

SQL> shu immediate;

SQL> startup
ORACLE instance started.

Total System Global Area 534462464 bytes
Fixed Size 2230072 bytes
Variable Size 163580104 bytes
Database Buffers 360710144 bytes
Redo Buffers 7942144 bytes
Database mounted.
Database opened.

SQL> select switchover_status, database_role from v $ database;

SWITCHOVER_STATUS DATABASE_ROLE


NOT ALLOWED PRIMARY

  • Recover managed operation runs on the New Secondary Old Primary side

alter database add standby logfile group 5 ‘/u01/app/oracle/orcl/standby02.log’ size 20737418;
alter database add standby logfile group 6 ‘/u01/app/oracle/orcl/standby03.log’ size 20737418;
alter database add standby logfile group 7 ‘/u01/app/oracle/orcl/standby04.log’ size 20737418;
alter database add standby logfile group 8 ‘/u01/app/oracle/orcl/standby05.log’ size 20737418;

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

Database altered.

Congrat.

Comments