Wednesday, February 23, 2011

Enable Active Dataguard on 11gR2 RAC Standby

The RAC-to-RAC dataguard created earlier is used to enable active dataguard.

The standby site has two instances all in mounted mode and log apply enable on one instnace. To enable active dataguard

1. In this case log apply process is enabled on rac4b therefore cancel log apply process on that node. No action is required on other node rac5b.
SQL> alter database recover managed standby database cancel;
Database altered.
2. Open the database in read only mode. Since database added to cluster to startup default on mount mode with
$GIRD_HOME/bin/srvctl add database -d rac11g2s -o $ORACLE_HOME -m local -p "+DATA/rac11g2s/spfilerac11g2s.ora" -n rac11g2 -r physical_standby -s mount
each instance must be started on read only mode if all of them are used for read only application. On rac4b
SQL> alter database open read only;
Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
---------
READ ONLY
After this on rac5b query the open mode to verify its still in mount mode and then open in read only mode
SQL>  select open_mode from v$database;

OPEN_MODE
---------
MOUNTED

SQL> alter database open read only;
Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
---------
READ ONLY
3. Start the log apply service on one instance with
SQL> alter database recover managed standby database using current logfile disconnect;
Database altered.
4. On both standby instances querying the open mode will give
SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY WITH APPLY
If data gurad broker is configured and redo apply is started then to enable active data guard

1.Stop the log apply on the standby using dgmgrl
DGMGRL> edit database rac11g2s set state='APPLY-OFF';
Succeeded.

DGMGRL> show database rac11g2s

Database - rac11g2s

Role: PHYSICAL STANDBY
Intended State: APPLY-OFF
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Real Time Query: OFF
Instance(s):
rac11g2s1 (apply instance)
rac11g2s2

Database Status:
SUCCESS
2. Open the standby database instances in read only mode using sql plus
SQL> alter database open read only;
Database altered.
3. Start the redo apply service again using dgmgrl
DGMGRL> edit database rac11g2s set state='APPLY-ON';
Succeeded.


Disabling Active Dataguard

1. Cancel the log apply service
SQL> alter database recover managed standby database cancel;
Database altered.
This will change open mode from READ ONLY WITH APPLY to READ ONLY
SQL> select open_mode from v$database;

OPEN_MODE
---------
READ ONLY
2. Shutdown and start (in mount mode) the standby database
srvctl stop database -d rac11g2s
srvctl start database -d rac11g2s

SQL> select open_mode from v$database;

OPEN_MODE
---------
MOUNTED
3. Enable log apply service
SQL> alter database recover managed standby database using current logfile disconnect;
Database altered.