In my previous post, I have shown you to create a Physical Standby Database. Now in this post I'll show you to configure a Data guard Broker and Observer for Switchover/Failover purpose.
I have followed the below steps to configure the Dataguard.
On both the Database i.e. on Primary as well as Standby.
1. Put down both the Databases in Flashback mode.
2. Added Standby Redo Logs.
3. Configured listener and tnsnames to enable the communication with both the DBs.
4. Created SPFILE for the Database.
5. Enabled the Data Guard Broker setting which creates the Broker Configuration files.
Performed over Primary Database(prim).
6. Created and enabled the DG configuration file and Database.
7. Enabled the Fast Start Failover and Observer.
8. Performed the Switchover and Failover.
I've attached the Network files for both the DBs.
@prim
listener.ora
tnsnames.ora
@stby
listener.ora
tnsnames.ora
DGMGRL> enable database stby;
SQL> SELECT DEST_ID,MAX(SEQUENCE#) FROM V$ARCHIVED_LOG
GROUP BY DEST_ID;
SQL> SELECT * FROM V$ARCHIVE_GAP;
I have followed the below steps to configure the Dataguard.
On both the Database i.e. on Primary as well as Standby.
1. Put down both the Databases in Flashback mode.
2. Added Standby Redo Logs.
3. Configured listener and tnsnames to enable the communication with both the DBs.
4. Created SPFILE for the Database.
5. Enabled the Data Guard Broker setting which creates the Broker Configuration files.
Performed over Primary Database(prim).
6. Created and enabled the DG configuration file and Database.
7. Enabled the Fast Start Failover and Observer.
8. Performed the Switchover and Failover.
I've attached the Network files for both the DBs.
@prim
listener.ora
tnsnames.ora
@stby
listener.ora
tnsnames.ora
DGMGRL> enable database stby;
Run the following queries, one in the current primary and two in the current standby to make sure the logs are shipped and applied before switchover.
@Prim: SQL> select thread#, max(sequence#) "Last Primary Seq Generated" from v$archived_log val, v$database vdb where val.resetlogs_change# = vdb.resetlogs_change# group by thread# order by 1;
@Stdby:SQL> select thread#, max(sequence#) "Last Standby Seq Received" from v$archived_log val, v$database vdb where val.resetlogs_change# = vdb.resetlogs_change# group by thread# order by 1;
@Stdby:SQL>select thread#, max(sequence#) "Last Standby Seq Applied" from v$archived_log val, v$database vdb where val.resetlogs_change# = vdb.resetlogs_change# and val.applied in ('YES','IN-MEMORY') group by thread# order by 1;
To check the lag.@Prim: SQL> select thread#, max(sequence#) "Last Primary Seq Generated" from v$archived_log val, v$database vdb where val.resetlogs_change# = vdb.resetlogs_change# group by thread# order by 1;
@Stdby:SQL> select thread#, max(sequence#) "Last Standby Seq Received" from v$archived_log val, v$database vdb where val.resetlogs_change# = vdb.resetlogs_change# group by thread# order by 1;
@Stdby:SQL>select thread#, max(sequence#) "Last Standby Seq Applied" from v$archived_log val, v$database vdb where val.resetlogs_change# = vdb.resetlogs_change# and val.applied in ('YES','IN-MEMORY') group by thread# order by 1;
SQL> SELECT DEST_ID,MAX(SEQUENCE#) FROM V$ARCHIVED_LOG
GROUP BY DEST_ID;
SQL> SELECT * FROM V$ARCHIVE_GAP;
No comments:
Post a Comment