Active Data Guard

Oracle 11gR2 - Active Data Guard.
Active Data Guard allows a standby database to be opened for read-only access while redo is still being applied. However, this benefit is offset to a certain extent by the fact that Active Data Guard is available on Enterprise Edition only and is cost option which must be licensed on both the primary and standby database.

1. How to determine whether a standby database is using Active Data Guard, use the following query:
SQL> SELECT database_role, open_mode FROM v$database;

For example:
SQL> SELECT database_role, open_mode FROM v$database;

DATABASE_ROLE     OPEN_MODE
----------------                  --------------------
PHYSICAL STANDBY READ ONLY WITH APPLY

2. How to start the ADG.
### If you start a database in SQL*Plus using the STARTUP command and then invoke managed recovery, the Active Data Guard will be enabled.


For example:
$ sqlplus / as sysdba
SQL> STARTUP

ORACLE instance started.
Total System Global Area 6497189888 bytes
Fixed Size 2238672 bytes
Variable Size 3372222256 bytes
Database Buffers 3103784960 bytes
Redo Buffers 18944000 bytes
Database mounted
Database opened

SQL> SELECT database_role, open_mode FROM v$database;

DATABASE_ROLE    OPEN_MODE
----------------         --------------------
PHYSICAL STANDBY  READ ONLY

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
USING CURRENT LOGFILE WITH SESSION SHUTDOWN;

SQL> SELECT database_role, open_mode FROM v$database;

DATABASE_ROLE    OPEN_MODE
---------------- --------------------
PHYSICAL STANDBY READ ONLY WITH APPLY

 

### In the database has been started in SQL*Plus using STARTUP MOUNT and the database is subsequently opened read only, then invoking managed recovery will enable Active Data Guard.

For example:

$ sqlplus / as sysdba

SQL> STARTUP MOUNT

ORACLE instance started.

Total System Global Area 6497189888 bytes

Fixed Size 2238672 bytes

Variable Size 3372222256 bytes

Database Buffers 3103784960 bytes

Redo Buffers 18944000 bytes

Database mounted

Database opened

 

SQL> SELECT database_role, open_mode FROM v$database;

 

DATABASE_ROLE    OPEN_MODE

----------------          --------------------

PHYSICAL STANDBY  MOUNTED

 

SQL> ALTER DATABASE OPEN READ ONLY;

 

SQL> SELECT database_role, open_mode FROM v$database;

 

DATABASE_ROLE    OPEN_MODE

---------------- --------------------

PHYSICAL STANDBY READ ONLY

 

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE

USING CURRENT LOGFILE WITH SESSION SHUTDOWN;

 

SQL> SELECT database_role, open_mode FROM v$database;

 

DATABASE_ROLE    OPEN_MODE

----------------          --------------------

PHYSICAL STANDBY  READ ONLY WITH APPLY

 

###Of course not all databases are started using SQL*Plus.

If you start the database using SRVCTL then the default open mode can be specified in the OCR.

If the database is started using SRVCTL then the database will be opened in read-only mode. For example:

$ srvctl start database -d ORCL

 

The default start mode can be modified in the OCR using the SRVCTL MODIFY DATABASE command.

For example:

$ srvctl modify database -d ORCL-s mount

 

You can also specify the start mode as a parameter to the SRVCTL START DATABASE command

For example:

$ srvctl start database -d ORCL -o open

$ srvctl start database -d ORCL -o mount

Take care when performing a switchover or switchback that the OCR is updated as part of the procedure.

请使用浏览器的分享功能分享到微信等