In this Document

  Purpose
 

_afrLoop=1459323732561579&id=1312749.1&displayIndex=10&_afrWindowMode=0&_adf.ctrl-state=foyvm6hmv_144#SCOPE">Scope

  Details
 

_afrLoop=1459323732561579&id=1312749.1&displayIndex=10&_afrWindowMode=0&_adf.ctrl-state=foyvm6hmv_144#aref_section31">Concepts & Overview

 

_afrLoop=1459323732561579&id=1312749.1&displayIndex=10&_afrWindowMode=0&_adf.ctrl-state=foyvm6hmv_144#aref_section32">Administrator-managed Database

  Basic Method
  Preconnect Method
  Policy-managed Database
  Basic Method

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.1 to 11.2.0.3 [Release 11.2]

Oracle Net Services - Version 11.2.0.1 to 11.2.0.3 [Release 11.2]

Information in this document applies to any platform.

Purpose

This article describes Transparent Application Failover (TAF) and provides configuration details for 11gR2(11.2) cluster database.

Scope

This article is intended for Oracle Cluster Administrators who would like more details about TAF. Basic understanding of Oracle Clusterware Database is assumed.

Details

Concepts & Overview

TAF allows Oracle clients to reconnect to a surviving instance in the event of a failure of the instance to which it is connected. There are two types of TAF available, SESSION and SELECT.




SESSION: Session Failover re-creates the connections and sessions to the surviving instance.

SELECT:  In addition to recreating the session, Select Failover also replays the queries that were in progress.






There are two methods in which TAF estabilishes the failover connection, BASIC and PRECONNECT.




BASIC: The second connection is re-established only after the first connection to the instance failed.

PRECONNECT: Two connections are established when the client logs in to the database. A login to database will create two connection at the same time. For this to work, clusterware actually starts two services. One main service and another shadow
service.





TAF can be configured at the Oracle Client side in tnsnames.ora or at the Database Server side using the SRVCTL utility.  Configuring it at the server is preferred as it is convenient to put the configuration in one place i.e. on the server. This article covers
the configuration at the server using SRVCTL.  TAF configuration is associated with the database service.




1. Create the service with SRVCTL

SRVCTL defines services in OCR which is accessible across nodes. The service configuration details can be viewed with the SRVCTL config service command.



2. Start the Service with SRVCTL

When the service is started with SRVCTL, it actually creates a service in the database. The service name and the configuration details of the service created at the database can be viewed with DBA_SERVICES view. Then the SERVICE_NAMES database parameter is
set, which allows PMON to register this service with the listener.  Once the new service is registered, remote client connections can established through the listener.

NOTE:

The clusterware automatically starts/stops and manages the services in the database according to the configuration of the service. Manually setting the SERVICE_NAMES parameter in RAC is not allowed as clusterware manages setting this parameter.

Let's have a look at the srvctl syntax for creating service. Databases in 11gR2 can be Administrator-managed or Policy-managed. Certain options can be used only with certain type of database.

srvctl add service -d <db_unique_name> -s <service_name>


-r "<preferred_list>" [-a "<available_list>"] [-P {BASIC | NONE | PRECONNECT}]

-g <server_pool> [-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>]

Here is the description of the options that we are going to use in configuring TAF.




-r "<preferred_list>" [-a "<available_list>"] [-P {BASIC | NONE | PRECONNECT}]

         This clause is valid only for Administrator-managed database which support PRECONNECT method.


-g <server_pool> [-c {UNIFORM | SINGLETON}]

         This clause is valid only for Policy-managed database where in PRECONNECT method is not available.



The above two options instruct clusterware on how to handle this service.



[-e {NONE|SESSION|SELECT}]

        This defines the type of TAF whether SESSION or SELECT.

[-m {NONE|BASIC}]

        This defines the method of TAF.

[-z <failover_retries>]

        This defines the the number of times to attempt to connect after a failover.


[-w <failover_delay>]

       This defines the amount of time in seconds to wait between connect attempts.




Above four options are passed to database while starting up the service and is viewable in DBA_SERVICES view.

Administrator-managed Database

Basic Method

1. Create Service



Syntax:

          srvctl add service -d <db_unique_name> -s <service_name>

          -r "<preferred_list>" [-a "<available_list>"] [-P {BASIC | NONE | PRECONNECT}]


         [-e {NONE|SESSION|SELECT}]

         [-m {NONE|BASIC}]

         [-z <failover_retries>]

         [-w <failover_delay>]





Example:

         $ srvctl add service -d db112 -s mysrvb
-r db1121,db1122 -P basic -e select -m
basic -z 10 -w 2

Though this example only uses -r option, you can use both -r and -a option.

2. Start the service

$ srvctl start service -d db112 -s mysrvb



Check if the service is registered with the listener.

$lsnrctl status LISTENER_SCAN1

. . .

. . .

Service "mysrvb" has 2 instance(s).

  Instance "db1121", status READY, has 1 handler(s) for this service...

  Instance "db1122", status READY, has 1 handler(s) for this service...

. . .

. . .

3. Make a connection.



The client connect string does not require any special TAF parameters. A simple tnsnames.ora entry as shown below will do.

mysrvb =

  (description =

   (address = (protocol=tcp)(host=secrac-scan)(port=1521))

   (connect_data=

    (service_name=mysrvb)

   )

  )
Note:  Please be aware that pre-11gR2 clients are not fully compatible with SCAN and require a special TNS connect string.  See the following Oracle Documentation:  http://www.oracle.com/technetwork/database/clustering/overview/scan-129069.pdf

$ sqlplus scott/tiger@mysrvb



Once connected GV$SESSION view will reflect the connection made is TAF enabled. The FAILOVER_METHOD and FAILOVER_TYPE column reflects it and this confirms the TAF configuration is correct.

SQL> select inst_id,username,service_name,failover_type,failover_method,failed_over from gv$session where username='SCOTT';



INST_ID USERNAME SERVICE_NAME FAILOVER_TYPE FAILOVER_M FAI

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

      1    SCOTT       mysrvb        SELECT      BASIC  NO

Note that this client has connected to the instance 1 with BASIC method and SELECT type.

Preconnect Method

1. Create service



Syntax:

           srvctl add service -d <db_unique_name> -s <service_name>

          -r "<preferred_list>" [-a "<available_list>"] [-P {BASIC | NONE | PRECONNECT}]


          [-e {NONE|SESSION|SELECT}]

          [-m {NONE|BASIC}]





Example:

          $ srvctl add service -d db112 -s mysrv
-r db1121 -a db1122 -P preconnect

NOTE:

* The -e, -m option should be set to none. Omitting this option actually sets it to none.

* Use both -r and -a option for preconnect so that a shadow service will be started.

2. Start the service.



$ srvctl start service -d db112 -s mysrv



Preconnect creates an additional shadow service.

$ crsctl stat res -t

. . .

. . .

ora.db112.mysrv.svc

          1 ONLINE ONLINE secrac1

ora.db112.mysrv_preconnect.svc

          1 ONLINE ONLINE secrac3

. . .

. . .

Note that the service 'mysrv' is started on the preferred instance. And the shadow service
'mysrv_preconnect' is started on the available instance. The shadow service is always defined as
<servicename>_preconnect.





Check if the service is correctly registered with the listener.

$ lsnrctl status listener_scan1

. . .

. . .

Service "mysrv" has 1 instance(s).

  Instance "db1121", status READY, has 1 handler(s) for this service...

Service "mysrv_preconnect" has 1 instance(s).

  Instance "db1122", status READY, has 1 handler(s) for this service...

. . .

. . .


3. Define TNS entry.



Preconnect requires special parameters at the client side tnsnames.ora file. The TAF Type and the TAF method is actually specified at the client end.

mysrv =

  (description =

   (address = (protocol=tcp)(host=secrac-scan)(port=1521))

   (connect_data=

     (service_name=mysrv)

     (failover_mode=

       (backup=mysrv_preconnect)

       (type=select)

       (method=preconnect)

     )

   )

  )



mysrv_preconnect =

  (description =

   (address = (protocol=tcp)(host=secrac-scan)(port=1521))

   (connect_data=(service_name=mysrv_preconnect))

  )

Connect to the database with this tns entry



$sqlplus scott/tiger@mysrv

SQL> select inst_id,username,service_name,failover_type,failover_method,failed_over from gv$session where username='SCOTT';



INST_ID USERNAME     SERVICE_NAME FAILOVER_TYPE FAILOVER_M FAI

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

      1    SCOTT            mysrv        SELECT PRECONNECT  NO

      2    SCOTT mysrv_preconnect          NONE       NONE  NO

Note that the client has made two connections. The first one is the active main connection with PRECONNECT method and SELECT type. The second one is the shadow connection that will be used if the connection to the first instance fails.

Policy-managed Database

Basic Method

1. Create the service



Syntax:

          srvctl add service -d <db_unique_name> -s <service_name>

          -g <server_pool> [-c {UNIFORM | SINGLETON}]

          [-e {NONE|SESSION|SELECT}]

          [-m {NONE|BASIC}]

          [-z <failover_retries>]

          [-w <failover_delay>]





Example:

         $ srvctl add service -d db1 -s mysrvp
-g
mysrvpool -c uniform -e select -m basic
-z 10 -w 2





2.
Start the service



$ srvctl start service -d db1 -s mysrvp





Check if the service is correctly registered with the listener

$ lsnrctl status listener_scan1

. . .

. . .

Service "mysrvp" has 2 instance(s).

  Instance "db1_1", status READY, has 1 handler(s) for this service...

  Instance "db1_2", status READY, has 1 handler(s) for this service...

. . .

. . .

3. Make a connection.



The client connect string does not require any special TAF parameters. A simple tnsnames.ora entry as shown below will do.

mysrvp =

  (description =

   (address = (protocol=tcp)(host=secrac-scan)(port=1521))

   (connect_data=

     (service_name=mysrvp)

   )

  )

$ sqlplus scott/tiger@mysrvp

SQL> select inst_id,username,service_name,failover_type,failover_method,failed_over from gv$session where username='SCOTT';



INST_ID USERNAME SERVICE_NAME FAILOVER_TYPE FAILOVER_M FAI

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

      1    SCOTT       mysrvp        SELECT      BASIC  NO

11gR2(11.2) RAC TAF Configuration for Admin and Policy Managed Databases (文档 ID 1312749.1)的更多相关文章

  1. 11gR2 Database Services for &quot;Policy&quot; and &quot;Administrator&quot; Managed Databases (文档 ID 1481647.1)

    In this Document   Purpose   _afrLoop=1459311711568804&id=1481647.1&displayIndex=6&_afrW ...

  2. Best Practices and Recommendations for RAC databases with SGA size over 100GB (文档 ID 1619155.1)

    Best Practices and Recommendations for RAC databases with SGA size over 100GB (文档 ID 1619155.1) APPL ...

  3. Troubleshooting 10g and 11.1 Clusterware Reboots (文档 ID 265769.1)

    Troubleshooting 10g and 11.1 Clusterware Reboots (文档 ID 265769.1) This document is intended for DBA' ...

  4. Clusterware 和 RAC 中的域名解析的配置校验和检查 (文档 ID 1945838.1)

    适用于: Oracle Database - Enterprise Edition - 版本 10.1.0.2 到 12.1.0.1 [发行版 10.1 到 12.1]Oracle Database ...

  5. 如何诊断 11.2 集群节点驱逐问题 (文档 ID 1674872.1)

    适用于: Oracle Database - Enterprise Edition - 版本 11.2.0.1 到 11.2.0.2 [发行版 11.2]本文档所含信息适用于所有平台 用途 这篇文档提 ...

  6. How to remove a Data Guard Configuration from Primary Database (文档 ID 733794.1)

    APPLIES TO: Oracle Database - Enterprise Edition - Version 10.1.0.2 to 11.2.0.3 [Release 10.1 to 11. ...

  7. Security Configuration and Auditing Scripts for Oracle E-Business Suite (文档 ID 2069190.1)

    This document provides the security configuration and auditing scripts for Oracle E-Business Suite. ...

  8. 跟我学SharePoint 2013视频培训课程——删除恢复、文档离线工作(11)

    课程简介 第11天,怎样在SharePoint 2013中删除.恢复文档.文档离线工作. 视频 SharePoint 2013 交流群 41032413

  9. 【总文档】rac增加新节点的方法步骤 How to Add Node/Instance or Remove Node/Instance in 10gR2, 11gR1, 11gR2 and 12c Oracle Clusterware and RAC

    [总文档]How to Add Node/Instance or Remove Node/Instance in 10gR2, 11gR1, 11gR2 and 12c Oracle Clusterw ...

随机推荐

  1. GCD基本使用

    主要概念 队列 dispatch_queue_t,队列名称在调试时辅助,无论什么队列和任务,线程的创建和回收不需要程序员操作,有队列负责. 串行队列:队列中的任务只会顺序执行(类似跑步) dispat ...

  2. 在Vista以上版本运行WTL程序,有时候会提示“这个程序可能安装补正确...”的错误

    在Win7/Vista下,如何以兼容模式运行exe?     https://msdn.microsoft.com/en-us/library/dd371711(VS.85).aspx     问题描 ...

  3. 无法从“const char *”转换为“char *”

    写了如下的一段代码: const char *str; char *p=str; 提示错误: const char* 不能用于初始化char *类型的实体.这是为什么?我想应该是const char ...

  4. window下svn注册为本地的服务

    sc create svnservice binpath= "\"C:\program files\Subversion\bin\svnserve.exe\" --ser ...

  5. 分享一个嵌入式httpdserver开发库 - boahttpd library

    http://sourceforge.net/projects/boahttpd/ 一个C接口的开发库,适用于 windows/linux/或其它嵌入式平台,支持CGI扩展,支持多线程.採用面向对象开 ...

  6. 数据结构读书笔记(三)(C语言)

    栈 顺序实现: 存储结构: #define STACK_INIT_SIZE 10 // 存储空间初始分配量 #define STACK_INCREMENT 2 // 存储空间分配增量 struct S ...

  7. BZOJ 3357: [Usaco2004]等差数列( dp )

    dp(x, p) 表示序列中第x个数, 上一个数是p构成的等差数列的最长. 转移时从[1, x)中枚举p = seq[] 就行了.时间复杂度O(n²logn) -------------------- ...

  8. dos2unix与unix2dos之学习记录

    1. unix2dos与dos2unix这两个tool是用来干什么的? 这首先应该要说明一下背景知识: unix类操作系统下,换行字符是\n: 而早期的dos操作系统,其换行字符是由\r\n组成. 所 ...

  9. 高焕堂《android从程序员到架构师之路》 YY讲坛直面大师学习架构设计

    <android从程序员到架构师之路>YY讲坛活动:  sundy携手高焕堂老师全程YY答疑 与大师一起,分享android技术 时间:7月21日下午2:00   报名联系QQ:22243 ...

  10. Java与C#的语法区别(不断更新中...)

    1.static关键字: 在java中静态成员能够被对象和类名调用: 在C#中,静态成员只能被类调用不能被对象调用. 2.for循环: 在java中可以在for前面添加标记,然后在for循环中可以br ...