Saturday, November 29, 2008

Switchover and Switchback in a CASCADED STANDBY SETUP with Oracle 10gR2

Dear All,

This is first of the challenges we all might have faced while doing a switchover and switchback with Oracle Database having cascaded standby setup:
Primary Database: epprod2
First Standby Database: epstby2
Second Standby Database (cascaded standby DB): epdr2

Steps are given below:

SWITCHOVER:

On Standby (epstby2):
alter system set log_archive_dest_state_2=DEFER;
alter database recover managed standby database cancel;
shutdown immediate;
Keep it as a backup

On Primary (epprod2):
alter system set log_archive_dest_state_3=DEFER;
alter system set log_archive_dest_2='SERVICE=epdr2 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=epdr2 max_connections=4';
alter system set log_archive_dest_state_2=ENABLE;
alter system switch logfile;
alter system switch logfile;
select switchover_status from v$database;
alter database commit to switchover to standby with session shutdown;
shutdown immediate
startup nomount
alter database mount standby database;
alter system set log_archive_dest_state_2=defer;
alter database recover managed standby database disconnect from session;
select max(sequence#) from v$log_history;

On Cascaded Standby (DR - epdr2):
select switchover_status from v$database;
alter database commit to switchover to primary with session shutdown;
shutdown immediate
startup
alter system set log_archive_dest_state_2=ENABLE;
alter system switch logfile;
alter system switch logfile;
select max(sequence#) from v$archived_log;


SWITCHBACK:

On Primary (epdr2):
select switchover_status from v$database;
alter database commit to switchover to standby with session shutdown;
shutdown immediate
startup nomount
alter database mount standby database;
alter system set log_archive_dest_state_2=defer;
alter database recover managed standby database disconnect from session;
select max(sequence#) from v$log_history;

On Cascaded Standby (epprod2):
select switchover_status from v$database;
alter database commit to switchover to primary with session shutdown;
shutdown immediate
startup
alter system set log_archive_dest_state_2=ENABLE;
alter system switch logfile;
alter system switch logfile;
alter system set log_archive_dest_state_2=DEFER;
alter system set log_archive_dest_2='SERVICE=epdr2 VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=epdr2'
alter system set log_archive_dest_state_3=ENABLE;
select max(sequence#) from v$archived_log;

On Standby (epstby2):
startup nomount;
alter database mount standby database;
alter database recover managed standby database disconnect from session; (Till the Gap is resolved)
alter database recover managed standby database disconnect from session;
alter database recover managed standby database disconnect from session;
alter system set log_archive_dest_state_2=ENABLE;

Hope this helps ...
Paresh

No comments: