Do Attend Live Webinar on - "Live Demonstration of Dataguard Switch Over or Fail Over - DR Drill"
Join Zoom Meeting - Sat 05-Jun-2021 @ 7:30 PM IST
More details can be found in our DBA Telegram group @mallik034
Agenda:
1.DataGuard Switch Over Understanding
2.DataGuard Fail Over Understanding
3.Live Demonstration on Switch Over and Switch Back
4.Q&A
Details Steps:
12c Data guard Switchover Best Practices using SQLPLUS (Doc ID 1578787.1)
#########################################################################
Before Switch Over Environment details:
PROD Environment :
DB: ORCL
Server: oracledb.localdomain.com
Oracle Home: /u01/app/oracle/product/19.0.0.0/dbhome_1
DR Environment :
DB: ORCLSB
Server: oraclesb.localdomain.com
Oracle Home: /u01/app/oracle/product/19.0.0.0/dbhome_1
Step 1:- Verify the database is ready for switch over or not?
SQL> alter database switchover to ORCLSB verify;
Step 2:- Check database role and database name
Primary DB:
select name,open_mode,database_role from v$database;
Standby DB:
select name,open_mode,database_role from v$database;
Precheck for Switchover:-
Step 3:- Verify the state of data guard on both the databases with following SQL queries:
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#;
Step 4:- select switchover_status from v$database;
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
Primary DB:
Step 5:-
SQL> alter database commit to switchover to standby;
Step 6:-
shutdown immediate;
startup nomount;
alter database mount standby database;
Step 7:- select name,open_mode,database_role from v$database;
alter database recover managed standby database disconnect from session;
Standby DB:
Step 8:- alter database commit to switchover to primary;
Step 9:- select name,open_mode,database_role from v$database;
After Switch Over Environment details:
PROD Environment :
DB: ORCL
Server: oracledb.localdomain.com
Oracle Home: /u01/app/oracle/product/19.0.0.0/dbhome_1
DR Environment :
DB: ORCLSB
Server: oraclesb.localdomain.com
Oracle Home: /u01/app/oracle/product/19.0.0.0/dbhome_1
Other Helpful commands:
Enable and disable log_archive_dest_state_2 / log shipping to standby:
alter system set log_archive_dest_state_2=DEFER scope=both sid='*';
alter system set log_archive_dest_state_2=enable scope=both sid='*';
Start and stop the log shipping apply at DR database:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE disconnect from session;
alter database recover managed standby database cancel;
Regards,
Mallik
No comments:
Post a Comment