We will see how to switchover the database role from primary to standby and vice versa
Switchover is the process or allowing to the primary/standby database to switch their role with their
respective primary/standby database. Where there is no any data loss during the role change this is known as switchover.
Switchover is the process or allowing to the primary/standby database to switch their role with their
respective primary/standby database. Where there is no any data loss during the role change this is known as switchover.
There are two
main database role
1) Primary database
2) Standby database
Primary Database:-
Is the
database where all the active user connection are coming from end user.
Standby Database:-
The database is
connected to primary database any work happens
on the primary database will get reflect to standby database in the form
of redo data. In some times it is used for reporting purpose (read only) mode.
Before going to switch over need to consider below things.
1)
Standby database need to be in sync with
primary.
2)
Check network connection between primary and
standby it need to be active
3)
Check Standby redo logs(SRL’s) are configured on
primary side.
Starting Manual Switchover
1)
On Primary Database
1.1) check switchover status
SQL> select switchover_status
from v$database;
SWITCHOVER_STATUS
-----------------------------
To STANDBY
Note:- You will get output
Active session OR To standby
1.2) Change the switchover status
SQL> Alter database commit to
switchover to physical standby with session shutdown;
Database altered
SQL> shutdown immediate
SQL> startup nomount
SQL>alter database mount
standby database;
2) On Standby Database
2.1) check the switchover
status
SQL> select
switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO PRIMARY
2.2) Stop the Managed Recovery Process (MRP)
SQL> alter
database recover managed standby database cancel;
2.3) execute below command to switchover standby database to
Primary
SQL> Alter database commit to switchover to primary;
SQL> shut immediate
SQL> startup
2.4) now check the database role it is now primary.
SQL> select name,open_mode,database_role from v$database;
NAME OPEN_MODE DATABASE_ROLE
--------- -------------------- ----------------
TESTDB READ WRITE
PRIMARY
3) Now on newly created standby database start Recovery
(MRP)
SQL>alter database recover managed standby database
disconnect from session;
Media recovery
completed
.
|