Active Data Guard适用于一些只读性的应用,比如,有的应用程序只是查询数据,进行一些报表业务,不会产生redo数据,这些应用可以转移到备库上,避免对主库资源的争用。
Oracle Active Data Guard 是Oracle Database Enterprise Edition的一个功能,需要额外付费来使用这个功能。
如需启用Active Data Guard, 只需要将备库以 read-only 模式打开,而且执行 ALTER DATABASE RECOVER MANAGED STANDBY DATABASE语句就可以。需要注意的是:主库和备库的COMPATIBLE 参数至少要设置为11.0.0。
如果已经启用了Active Data Guard,备库的V$DATABASE会显示为"READ ONLY WITH APPLY':
SQL> SELECT open_mode FROM V$DATABASE;
OPEN_MODE
--------------------
READ ONLY WITH APPLY
注意:使用Active
Data Guard要求主库和备库的COMPATIBLE 参数至少设置为11.0.0。
为了保证备库数据的实时性,需要在备库启动real-time apply:
SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE;
下面的功能是允许在read-only的数据库上执行的:
• Issue SELECT statements, including queries that require multiple sorts that leverage TEMP
segments
• Use ALTER SESSION and ALTER SYSTEM statements
• Use SET ROLE
• Call stored procedures
• Use database links (dblinks) to write to remote databases
• Use stored procedures to call remote procedures via dblinks
• Use SET TRANSACTION READ ONLY for transaction level read consistency
• Issue complex queries (such as grouping SET queries and WITH CLAUSE queries)
下面的功能是在read-only的数据库上执行的:
• Any DMLs (excluding simple SELECT statements) or DDLs
• Query accessing local sequences
• DMLs to local temporary tables
比较典型的Active Data Guard 分为:
• 单实例的物理主库和单实例的物理备库
• 主库为Oracle Real Application Clusters (Oracle RAC) ,备库为单实例
• RAC主库和RAC备库
Oracle Data Guard 的配置方法,,请参考下面的文档:
* 单实例的物理主库和单实例的物理备库:
http://docs.oracle.com/cd/B28359_01/server.111/b28294/create_ps.htm
* 主库为Oracle Real Application Clusters (Oracle RAC) ,备库为单实例:
http://www.oracle.com/technetwork/database/features/availability/maa-wp-10g-racprimarysingleinstance-131970.pdf
* RAC 主库和RAC 备库:
http://www.oracle.com/technetwork/database/features/availability/maa-wp-10g-racprimaryracphysicalsta-131940.pdf
关于Active Data Guard的最佳实践经验,请参考文档:
http://www.oracle.com/technetwork/database/features/availability/maa-wp-11gr1-activedataguard-1-128199.pdf
关于Oracle Maximum Availability Architecture Best Practices的更多文档,请参考:
http://www.oracle.com/goto/maa