Posted by
Roshan on
May 19, 2022; 11:43am
URL: http://erman-arslan-s-oracle-forum.124.s1.nabble.com/DR-test-tp10920.html
Hello Erman,
grateful if you can advise if below steps are ok for a DR drill?
Data guard switchover
Database/Host Details:
Primary database details:
Two Node RAC
IP: 10.242.1.146/48
SCAN: scan-db-dell.mytmoney
SID: PRODDB
Listener port: 1521
Secondary (Standby) database details:
Standalone DR
IP: 10.242.2.37
SID: PRODDBDR
Listener port: 1521
Objective: Perform switchover between primary and secondary so that the roles are reversed. The replication then occurs in the reverse direction.
• Backup database before starting activity (DC)
Rman> run
{
ALLOCATE CHANNEL C1 TYPE DISK '/localbackup/rmanBKP/Db_Full_bkp_%t_%s_%p.bkp';
ALLOCATE CHANNEL C2 TYPE DISK '/localbackup/rmanBKP/Db_Full_bkp_%t_%s_%p.bkp';
ALLOCATE CHANNEL C3 TYPE DISK '/localbackup/rmanBKP/Db_Full_bkp_%t_%s_%p.bkp';
backup database plus archivelog;
backup current controlfile format ‘/localbackup/rmanBKP/proddb_control.bkp’;
}
• Check the max archive log sequence number on DC:
SQL> select max(sequence#),thread# from v$archived_log group by thread#;
MAX(SEQUENCE#) THREAD#
-------------- ----------
217 2
422 1
• Check the max applied archive log sequence number on DR:
SQL> select max(sequence#),thread# from v$archived_log where applied='YES' group by thread#;
MAX(SEQUENCE#) THREAD#
-------------- ----------
422 1
217 2
The sequence number from DC and DR must be same.
• Check the archive log destination 2 status on both DC and DR:
SQL> select dest_name, status,error from v$archive_dest where dest_name ='LOG_ARCHIVE_DEST_2';
DEST_NAME STATUS ERROR
------------------------------ --------- -----------------------------------------------------------------
LOG_ARCHIVE_DEST_2 VALID
The STATUS must be VALID and there must not be any error in ERROR columns.
• Check the switchover status
DC :
SQL> select name,open_mode,database_role,inst_id,switchover_status from gv$database;
NAME OPEN_MODE DATABASE_ROLE INST_ID SWITCHOVER_STATUS
--------- -------------------- ---------------- ---------- --------------------
PRODDB READ WRITE PRIMARY 1 TO STANDBY
PRODDB READ WRITE PRIMARY 2 TO STANDBY
DR:
SQL> select name,open_mode,database_role,inst_id,switchover_status from gv$database;
NAME OPEN_MODE DATABASE_ROLE INST_ID SWITCHOVER_STATUS
--------- -------------------- ---------------- ---------- --------------------
PRODDB MOUNTED PHYSICAL STANDBY 1 NOT ALLOWED
SQL>
Note: On DC, SWITCHOVER_STATUS must be “TO STANDBY” or “NOT ALLOWED”.
On DR, SWITCHOVER_STATUS must be “TO PRIMARY” or “NOT ALLOWED”.
• Convert the primary database to standby:
Execute below on any one node in DC:
SQL> alter database commit to switchover to standby with session shutdown;
Database altered.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1.0972E+10 bytes
Fixed Size 12152768 bytes
Variable Size 2214596672 bytes
Database Buffers 8724152320 bytes
Redo Buffers 21397504 bytes
Database mounted.
• Start the second node in mount state.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1.0972E+10 bytes
Fixed Size 12152768 bytes
Variable Size 2214596672 bytes
Database Buffers 8724152320 bytes
Redo Buffers 21397504 bytes
SQL> select name,open_mode,database_role,inst_id,switchover_status from gv$database;
NAME OPEN_MODE DATABASE_ROLE INST_ID SWITCHOVER_STATUS
--------- -------------------- ---------------- ---------- --------------------
PRODDB MOUNTED PHYSICAL STANDBY 1 RECOVERY NEEDED
PRODDB MOUNTED PHYSICAL STANDBY 2 RECOVERY NEEDED
The database role must be physical standby.
• Start the standby media recovery process.
SQL> alter database recover managed standby database disconnect from session;
Database altered.
On standby :
• Check the archive destination 2 status:
SQL> select dest_name,status,error from v$archive_dest where dest_name='LOG_ARCHIVE_DEST_2';
DEST_NAME STATUS ERROR
-------------------- --------- -----------------------------------------------------------------
LOG_ARCHIVE_DEST_2
The STATUS must be VALID and there must not be any error in ERROR columns.
• Stop the media recovery on standby and switchover to primary::
SQL>alter database recover managed standby database cancel;
Database altered.
SQL>alter database commit to switchover to primary;
Database altered.
SQL>Alter database open;
SQL> select name,open_mode,database_role,inst_id,switchover_status from gv$database;
NAME OPEN_MODE DATABASE_ROLE INST_ID SWITCHOVER_STATUS
--------- -------------------- ---------------- ---------- --------------------
PRODDB READ WRITE PRIMARY 1 RESOLVABLE GAP
Note: For switchback, please follow the same steps from beginning.
Is it easier to use the flasback method instead of the above?
http://ermanarslan.blogspot.com/2016/05/ebs-dr-dataguard-switchover-tests.htmlThanks,
Roshan