Wednesday, 29 January 2025

Oracle Database Switch Over and Switch Back

Switch Over & Switch BACK STEP at Primary & DR (Standby server) manual. Before performing activity bounce both the instance (oracle DB). Primary Server (10.43.9.21) : step (Switch Over) :- Step 1 :- Primary : • Arhchive log list • Alter system switch logfile. • select name , instance_name , open_mode , database_role , switchover_Status from v$database , v$instance ; • alter database commit to switchover to physical standby with session shutdown ; • shutdown immediate; • startup nomount; • alter database mount standby database; • show parameter log_archive_Dest_state_2; • alter system set log_Archive_dest_State_2=defer scope=both; • select name , open_mode , database_role , switchover_status from v$database; • show parameter log_archive_Dest_state_2; Step 2 :- On Standby • Archive log list; • select name , instance_name , open_mode , database_role , switchover_Status from v$database , v$instance ; • alter database commit to switchover to primary ; • shutdown immediate • startup Step 3:- After switch, DR will be out of synch. check the application connection. Step 4:- New standby (previously Primary) -- synch the database. • select name , instance_name , open_mode , database_role , switchover_Status from v$database , v$instance ; • show parameter log_archive_Dest_state_2; • alter system set log_Archive_dest_State_2=enable scope=both; • Alter database open read only; • alter database recover managed standby database disconnect from session using current logfile; • select process ,status , sequence# from v$managed_Standby ; Standby Server (10.45.237.140) step (Switch Over) :- Step 1:- Old Primary • Archive log list ; • select name , instance_name , open_mode , database_role , switchover_Status from v$database , v$instance ; • alter database commit to switchover to primary; (-- Wait for few min , it will take a time.) • shutdown immediate; • startup • select name , instance_name , open_mode , database_role , switchover_Status from v$database , v$instance ; • show parameter log_Archive_dest_State_2; • alter system set log_archive_dest_state_2=enable scope=both; • show parameter log_Archive_dest_State_2; • Archive log list • (Alter system switch logfile). • select status , gap_status from v$archive_dest_status where dest_id=2; Step 2 :- Old Standby • Archive log list; • select name , instance_name , open_mode , database_role , switchover_Status from v$database , v$instance ; • alter database commit to switchover to physical standby with session shutdown; (Take time) • shut immediate; • startup nomount; • alter database mount standby database; • alter system set log_archive_dest_state_2=defer scope=both; • show parameter log_archive_Dest_state_2; Step 3:- After switch, DR will be out of synch. check the application connection. Step 4:- On Standby • select name , instance_name , open_mode , database_role , switchover_Status from v$database , v$instance ; • show parameter log_archive_Dest_state_2; • alter system set log_archive_dest_state_2=enable scope=both; • Alter database open read only; • alter database recover managed standby database disconnect ; • select process , status , sequence# from v$managed_standby ; Get current_Scn from standby server SELECT CURRENT_SCN FROM V$DATABASE; Select max(sequence#) from v$log_history; col hostname for a20 set lines 300 SELECT DB_NAME, HOSTNAME, LOG_ARCHIVED, LOG_APPLIED, APPLIED_TIME, LOG_ARCHIVED - LOG_APPLIED LOG_GAP FROM (SELECT NAME DB_NAME FROM V$DATABASE), (SELECT UPPER ( SUBSTR ( HOST_NAME, 1, (DECODE (INSTR (HOST_NAME, '.'), 0, LENGTH (HOST_NAME), (INSTR (HOST_NAME, '.') - 1))))) HOSTNAME FROM V$INSTANCE), (SELECT MAX (SEQUENCE#) LOG_ARCHIVED FROM V$ARCHIVED_LOG WHERE DEST_ID = 1 AND ARCHIVED = 'YES'), (SELECT MAX (SEQUENCE#) LOG_APPLIED FROM V$ARCHIVED_LOG WHERE DEST_ID = 2 AND APPLIED = 'YES'), (SELECT TO_CHAR (MAX (COMPLETION_TIME), 'DD-MON/HH24:MI') APPLIED_TIME FROM V$ARCHIVED_LOG WHERE DEST_ID = 2 AND APPLIED = 'YES');

Oracle Database Switch Over and Switch Back

Switch Over & Switch BACK STEP at Primary & DR (Standby server) manual. Before performing activity bounce both the instance (oracl...