Thursday, 13 January 2022

Oracle Datagaurd SwitchOver Steps

 Oracle Datagaurd Switchover steps manual and using DGBroker. 


Manual Steps.

On Primary:

  • 1.select name,instance_name,open_mode,database_role, switchover_status  from v$database,v$instance;
  • 2. alter database commit to switchover to physical standby with session shutdown;
  • 3. shut immediate;

On Standby:

  • 1.     alter database recover managed standby database cancel;
  • 2.  alter database commit to switchover to primary with session shutdown;
  • 3.  alter database open;
  • 4.  select name, open_mode, log_mode from v$database;
  • 5.  shut immediate;
  • 6.  startup
  • 7.  alter system switch logfile;

On New standby (old primary)

  • 1.     startup nomount;
  • 2.     alter database mount standby database;
  • 3.     Alter database recover managed standby database disconnect from session.

4.     Check for the sync status.



prompt ++++++++++++++++++++LAST SEQUENCE RECIEVED FROM PRODUCTION and APPLIED ON STANDBY+++++++++++++++++++++++++


set time on

set lines 200
select name, open_mode, database_role from v$database;

SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY where PROCESS like '%MRP%';

show parameter fal

select process, thread#, sequence#, status from v$managed_standby where process='MRP0';



SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference" FROM 
(SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH, 
(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL WHERE  ARCH.THREAD# = APPL.THREAD# ;


Sharing a real time issue after the switch over. After switch over noticed new standby is not receiving the logs from primary. 

Perform below steps in new primary only  if new standby not receiving the logs for synchronize. 

  • 1.     show parameter log_archive_dest_state_2;
  • 2.     alter system set log_archive_dest_state_2=defer scope=both;
  • 3.     alter system set log_archive_dest_state_2=enable scope=both;
  • 4.     alter system switch logfile;


Steps using DGMGRL:

 

If DGBroker is enabled in your environment then its very easy to perform the switch over. with just one command Primary database will be switched over. e.g


$dgmgrl

connect sys /

enter password

DGMGRL> switchover to 'Prod_SBY';

Performing switchover NOW, please wait...

New primary database "Prod_SBY" is opening...

Operation requires shutdown of instance "Prod" on database "Prod_PRIM"

Shutting down instance "Prod"...

ORACLE instance shut down.

Operation requires startup of instance "Prod" on database "Prod_PRIM"

Starting instance "Prod"...

ORACLE instance started.

Database mounted.

Switchover succeeded, new primary is "Prod_SBY"


I hope this going to help you for your activity. Questions are welcomed.👍



No comments:

Post a Comment

Changing database name and/or database id using NID

  Changing database name and/or database id using NID   Oracle NID utility NID is utility to change the database name and/or database id. St...