Wednesday 9 October 2024

step by step Oracle 12c Data Guard Switchover

 

 Step:1 In Primary database check the database role and open_mode

SQL> select name,open_mode,database_role from v$database;

NAME      OPEN_MODE           DATABASE_ROLE
--------- -------------------- ----------------
BACHDB      READ WRITE           PRIMARY

SQL>

 Step:2 In standby database check the database role and open_mode

SQL> select name,open_mode,database_role from v$database;

NAME      OPEN_MODE           DATABASE_ROLE
--------- -------------------- ----------------
BACHDB      READ ONLY WITH APPLY PHYSICAL STANDBY

 

Step:2 Check archive log gap sequence

ALTER SESSION SET nls_date_format='DD-MON-YYYY HH24:MI:SS';
SELECT sequence#, first_time, next_time, applied FROM v$archived_log ORDER BY sequence#; 

 SQL> SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;

no rows selected

Step 3: Check switchover status in primary database

 SQL>  select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
TO STANDBY

SQL> 

 The switchover_status column of v$database can have the following values:

Not Allowed:-Either this is a standby database and the primary database has not been switched first, or this is a primary database and there are no standby databases
Session Active:- Indicates that there are active SQL sessions attached to the primary or standby database that need to be disconnected before the switchover operation is permitted
Switchover Pending:- This is a standby database and the primary database switchover request has been received but not processed.
Switchover Latent:- The switchover was in pending mode, but did not complete and went back to the primary database
To Primary:- This is a standby database, with no active sessions, that is allowed to switch over to a primary database
To Standby:- This is a primary database, with no active sessions, that is allowed to switch over to a standby database
Recovery Needed:- This is a standby database that has not received the switchover request

 

Step 4: On Primary database:-

SQL> alter database commit to switchover to standby;

 

Step 5 On old Primary database will become now standby
 

shutdown immediate

startup nomount

alter database mount standby database 

Step 6:-select name,open_mode,database_role from v$database;

 


No comments:

Post a Comment