11g 新特性:Active Data Guard

  在Oracle 11g之前,物理备库(physical Standby)在应用redo的时候,是不可以打开的,只可以mount。从11g开始,在应用redo的时候,物理备库可以处于read-only模式,这就称为Active Data Guard 。通过Active Data Guard,可以在物理备库进行查询或者导出数据,从而减少对主库的访问和压力。

   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。


   如下:在备库执行:  
   SQL>startup mount;
   SQL>alter database open read only;
   SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;


  如果已经启用了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 备库:
   10g: http://www.oracle.com/technetwork/database/features/availability/maa-wp-10g-racprimaryracphysicalsta-131940.pdf
   11g: http://www.oracle.com/technetwork/database/features/availability/dataguard11g-rac-maa-1-134639.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


评论:

Hi Jane,

我们知道在Active DataGuard里,JDBC客户端是不支持HA通知和TAF。可是我们发现在Client Failover Best Practices for Highly Available Oracle Databases: Oracle Database 11g Release 2里,有以下为JDBC客户端创建role-based service语句:
Standby cluster - JDBC: srvctl add service -d Houston -s oltpworkload -r ssb1,ssb2,ssb3,ssb4 -l PRIMARY -q FALSE -e NONE -m BASIC -w 0 -z 0

Primary cluster – JDBC r/o service: srvctl add service -d Austin -s reports -r ssa1,ssa2,ssa3,ssa4 -l PHYSICAL_STANDBY -q FALSE -e NONE -m BASIC -w 0 -z 0
Standby cluster – JDBC r/o service: srvctl add service -d Houston -s reports -r ssb1,ssb2,ssb3,ssb4 -l PHYSICAL_STANDBY -q FALSE -e NONE -m BASIC -w 0 -z 0

请问这里的m为什么设置为BASIC呢?(m为none时才表示关闭TAF)

Thanks,

发表于 guest 在 2013年11月14日, 09:55 上午 CST #

我看了一下您说的文档:http://www.oracle.com/technetwork/database/features/availability/maa-wp-11gr2-client-failover-173305.pdf

虽然-m 是basic,但是-e 是NONE, -e表示“Failover type (NONE, SESSION, or SELECT)”,所以-e为NONE,还是禁用TAF。

$ srvctl add service -h

Adds a service configuration to the Oracle Clusterware.

Usage: srvctl add service -d <db_unique_name> -s <service_name> {-r "<preferred_list>" [-a "<available_list>"] [-P {BASIC | NONE | PRECONNECT}] | -g <pool_name> [-c {UNIFORM | SINGLETON}] } [-k <net_num>] [-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-y {AUTOMATIC | MANUAL}] [-q {TRUE|FALSE}] [-x {TRUE|FALSE}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}] [-z <failover_retries>] [-w <failover_delay>] [-t <edition>] [-f]
-d <db_unique_name> Unique name for the database
-s <service> Service name
-r "<preferred_list>" Comma separated list of preferred instances
-a "<available_list>" Comma separated list of available instances
-g <pool_name> Server pool name
-c {UNIFORM | SINGLETON} Service runs on every active server in the server pool hosting this service (UNIFORM) or just one server (SINGLETON)
-k <net_num> network number (default number is 1)
-P {NONE | BASIC | PRECONNECT} TAF policy specification
-l <role> Role of the service (primary, physical_standby, logical_standby, snapshot_standby)
-y <policy> Management policy for the service (AUTOMATIC or MANUAL)
-e <Failover type> Failover type (NONE, SESSION, or SELECT)
-m <Failover method> Failover method (NONE or BASIC)
-w <integer> Failover delay
-z <integer> Failover retries
-t <edition> Edition (or "" for empty edition value)
-j <clb_goal> Connection Load Balancing Goal (SHORT or LONG). Default is LONG.
-B <Runtime Load Balancing Goal> Runtime Load Balancing Goal (SERVICE_TIME, THROUGHPUT, or NONE)
-x <Distributed Transaction Processing> Distributed Transaction Processing (TRUE or FALSE)
-q <AQ HA notifications> AQ HA notifications (TRUE or FALSE)
Usage: srvctl add service -d <db_unique_name> -s <service_name> -u {-r "<new_pref_inst>" | -a "<new_avail_inst>"} [-f]
-d <db_unique_name> Unique name for the database
-s <service> Service name
-u Add a new instance to service configuration
-r <new_pref_inst> Name of new preferred instance
-a <new_avail_inst> Name of new available instance
-f Force the add operation even though a listener is not configured for a network
-h Print usage

发表于 Jane 在 2013年11月25日, 05:33 下午 CST #

发表一条评论:
  • HTML语法: 禁用
About

本博客由Oracle全球技术支持中国区的工程师维护。为中文用户提供数据库相关的技术支持信息,包括常用的诊断工具、诊断方法、产品新特性、案例分析等。此外,MOS也陆续推出各类中文内容:技术通讯统一发布在Note 1529795.1 中,中文文档列表更新在Note 1533057.1 中,网上讲座请查看MOS文档 1456176.1,在"Archived"中可以下载历史的录音和文档。

Search

Archives
« 四月 2014
星期日星期一星期二星期三星期四星期五星期六
  
1
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
今天