设为首页 收藏本站
查看: 447|回复: 0

[经验分享] How To Configure Server Side Transparent Application Failover (文档 ID 460982.1)

[复制链接]

尚未签到

发表于 2018-10-23 08:24:20 | 显示全部楼层 |阅读模式
  In this Document
  APPLIES TO:
  Oracle Database - Enterprise Edition
  Information in this document applies to any platform.
GOAL
  How to configure Server Side Transparent Application Failover (TAF)?
  Server side TAF settings override client-side counterparts that might be configured in TNS connect descriptors. If TAF is not configured on the client side, then at a minimum, the failover type must be set to enable TAF. If the failover type is set on the server side, then the failover method will default to BASIC. Delay and retries are optional and may be specified independently.
SOLUTION
  1. Create a service on the RAC cluster to setup for TAF. Example creates a service called server_taf to the database called rac, with instance names rac1 & rac2.

  Please note for the service name, select a name that is unique and not the same as the default service name created. A special Oracle database service is created by default for your Oracle RAC database. This default service is always available on all instances in an Oracle RAC environment, unless an instance is in restricted mode. You cannot>  srvctl add service -d rac -s server_taf -r "rac1,rac2" -P BASIC
  2. Start the service server_taf
  srvctl start service -d rac -s server_taf
  3. Check service is running
  srvctl config service -d rac
  ractest PREF: rac1 rac2 AVAIL:
  server_taf PREF: rac1 rac2 AVAIL:
  4. Find the service_id value for the service just created
  sqlplus /nolog
  Connect / as sysdba
  SQL> select name,service_id from dba_services where name = 'server_taf';
  NAME                                                             SERVICE_ID
  ---------------------------------------------------------------- ----------
  server_taf                                                                6
  5. Review the standard setup for the services
  SQL>col name format a15
  col failover_method format a11 heading 'METHOD'
  col failover_type format a10 heading 'TYPE'
  col failover_retries format 9999999 heading 'RETRIES'
  col goal format a10
  col clb_goal format a8
  col AQ_HA_NOTIFICATIONS format a5 heading 'AQNOT'
  SQL>select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications
  from dba_services where service_id = 6
  NAME            METHOD      TYPE       RETRIES  GOAL       CLB_GOAL AQNOT
  --------------- ----------- ---------- -------- ---------- -------- -----
  server_taf                                                 LONG     NO
  Please note there is no values for method, type or retries. These are required todo server side TAF.

  The cause of this problem has been>  6. Add the server side failover parameters to the service. (Pre 11.2)
  Server side TAF method is BASIC. BASIC is the only value currently supported. This means that a new connection is established at failure time. It is not possible to pre-establish a backup connection. (which is to say, PRECONNECT is not supported)
  SQL> execute dbms_service.modify_service (service_name => 'server_taf' -
  , aq_ha_notifications => true -
  , failover_method => dbms_service.failover_method_basic -
  , failover_type => dbms_service.failover_type_select -
  , failover_retries => 180 -
  , failover_delay => 5 -
  , clb_goal => dbms_service.clb_goal_long);
  PL/SQL procedure successfully completed.

  Addtional failover parameters value can be found in the Oracle Database PL/SQL Packages and Types Reference 11g>  For 11.2 version use SVRCTL to modify the service
  srvctl modify service -d RAC -s server_taf -m BASIC -e SELECT -q TRUE -j LONG
  Service can be checked with the command:
  srvctl config service -d RAC
  Service name: server_taf
  Service is enabled
  Server pool: RAC_server_taf
  Cardinality: 2
  Disconnect: false
  Service role: PRIMARY
  Management policy: AUTOMATIC
  DTP transaction: false
  AQ HA notifications: true
  Failover type: SELECT
  Failover method: BASIC
  TAF failover retries: 0
  TAF failover delay: 0
  Connection Load Balancing Goal: LONG
  Runtime Load Balancing Goal: NONE
  TAF policy specification: BASIC
  Edition:
  Preferred instances: RAC1,RAC2
  Available instances:
  7. Check the service and we can now see values for Method, Type and Retries.
  SQL>select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications
  from dba_services where service_id = 6
  NAME            METHOD      TYPE        RETRIES GOAL       CLB_GOAL AQNOT
  --------------- ----------- ---------- -------- ---------- -------- -----
  server_taf      BASIC       SELECT          180 NONE       LONG     YES
  8. Check the listener has the service registered. (output will look similar too following, depending on version used)
  lsnrctl services
  Service "server_taf.za.oracle.com" has 2 instance(s).
  Instance "rac1", status READY, has 2 handler(s) for this service...
  Handler(s):
  "DEDICATED" established:0 refused:0 state:ready
  REMOTE SERVER
  (ADDRESS=(PROTOCOL=TCP)(HOST=dell01)(PORT=1521))
  "DEDICATED" established:0 refused:0 state:ready
  LOCAL SERVER
  Instance "rac2", status READY, has 1 handler(s) for this service...
  Handler(s):
  "DEDICATED" established:0 refused:0 state:ready
  REMOTE SERVER
  (ADDRESS=(PROTOCOL=TCP)(HOST=dell02)(PORT=1521))
  9. Create a net service name. Here we have client load balancing between the two nodes.
  SERVERTAF =
  (DESCRIPTION =
  (LOAD_BALANCE = yes)
  (ADDRESS = (PROTOCOL = TCP)(HOST = dell01)(PORT = 1521))
  (ADDRESS = (PROTOCOL = TCP)(HOST = dell02)(PORT = 1521))
  (CONNECT_DATA =
  (SERVICE_NAME = server_taf.za.oracle.com)
  )
  )
  10. Testing...
  SQL*Plus: Release 10.2.0.1.0 - Production on Tue Oct 2 12:15:44 2007
  Copyright (c) 1982, 2005, Oracle.  All rights reserved.
  Connected to:
  Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
  With the Partitioning, Real Application Clusters, OLAP and Data Mining options
  SQL> select host_name,instance_name from v$instance;
  HOST_NAME
  ----------------------------------------------------------------
  INSTANCE_NAME
  ----------------
  dell02
  rac2
  11. Shutdown the database in the node the connection has routed to
  SQL> select instance_name from V$instance;
  INSTANCE_NAME
  ----------------
  rac2
  SQL> shutdown abort;
  ORACLE instance shut down.
  12. TAF will now kick in
  SQL> /
  HOST_NAME
  ----------------------------------------------------------------
  INSTANCE_NAME
  ----------------
  dell01
  rac1
  Oracle Net client trace of sqlplus connection during failover shows :
  Shows the calling net service name
  [02-OCT-2007 12:15:44:618] niotns: Calling address: (DESCRIPTION=(LOAD_BALANCE=yes)(ADDRESS=(PROTOCOL=TCP)(HOST=dell01)(PORT=1521))
  (ADDRESS=(PROTOCOL=TCP)(HOST=dell02)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=server_taf.za.oracle.com)
  (CID=(PROGRAM=d:\oracle\102ee\bin\sqlplus.exe)(HOST=sflood-uk2)(USER=sflood))))
  Selected node dell02
  [02-OCT-2007 12:15:44:648] nttbnd2addr: looking up IP addr for host: dell02
  Connection handshake
  [02-OCT-2007 12:15:44:878] nscon: sending NSPTCN packet
  [02-OCT-2007 12:15:45:229] nscon: got NSPTRS packet
  [02-OCT-2007 12:15:45:229] nscon: sending NSPTCN packet
  [02-OCT-2007 12:15:45:429] nscon: got NSPTAC packet
  The select running
  [02-OCT-2007 12:16:04:046] nspsend: 00 00 00 00 00 E8 64 0B |......d.|
  [02-OCT-2007 12:16:04:046] nspsend: 01 2E 73 65 6C 65 63 74 |..select|
  [02-OCT-2007 12:16:04:046] nspsend: 20 68 6F 73 74 5F 6E 61 |.host_na|
  [02-OCT-2007 12:16:04:046] nspsend: 6D 65 2C 69 6E 73 74 61 |me,insta|
  [02-OCT-2007 12:16:04:046] nspsend: 6E 63 65 5F 6E 61 6D 65 |nce_name|
  [02-OCT-2007 12:16:04:046] nspsend: 20 66 72 6F 6D 20 76 24 |.from.v$|
  [02-OCT-2007 12:16:04:046] nspsend: 69 6E 73 74 61 6E 63 65 |instance|
  Here the the time the instance was shutdown
  [02-OCT-2007 12:16:05:077] nioqrc: exit
  [02-OCT-2007 12:18:20:642] nioqsn: entry
  Select attempts to run again
  [02-OCT-2007 12:18:20:652] nspsend: 00 00 00 00 00 E8 64 0B |......d.|
  [02-OCT-2007 12:18:20:652] nspsend: 01 2E 73 65 6C 65 63 74 |..select|
  [02-OCT-2007 12:18:20:652] nspsend: 20 68 6F 73 74 5F 6E 61 |.host_na|
  [02-OCT-2007 12:18:20:652] nspsend: 6D 65 2C 69 6E 73 74 61 |me,insta|
  [02-OCT-2007 12:18:20:652] nspsend: 6E 63 65 5F 6E 61 6D 65 |nce_name|
  [02-OCT-2007 12:18:20:652] nspsend: 20 66 72 6F 6D 20 76 24 |.from.v$|
  [02-OCT-2007 12:18:20:652] nspsend: 69 6E 73 74 61 6E 63 65 |instance|
  Fails, due to instance was shutdown

  [02-OCT-2007 12:18:20:652] nserror: nsres:>  [02-OCT-2007 12:18:20:652] nsrdr: error exit
  [02-OCT-2007 12:18:20:652] nsdo: nsctxrnk=0
  [02-OCT-2007 12:18:20:652] nsdo: error exit
  [02-OCT-2007 12:18:20:652] nioqer: entry
  [02-OCT-2007 12:18:20:652] nioqer: incoming err = 12151
  [02-OCT-2007 12:18:20:652] nioqce: entry
  [02-OCT-2007 12:18:20:652] nioqce: exit
  [02-OCT-2007 12:18:20:652] nioqer: returning err = 3113
  TAF kicks in
  [02-OCT-2007 12:18:20:652] nsc2addr: (DESCRIPTION=(LOAD_BALANCE=yes)(ADDRESS=(PROTOCOL=TCP)(HOST=dell01)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=server_taf.za.oracle.com)(CID=(PROGRAM=d:\oracle\102ee\bin\sqlplus.exe)(HOST=sflood-uk2)(USER=sflood))))
  Connection fails over to node dell01
  [02-OCT-2007 12:18:20:652] nttbnd2addr: looking up IP addr for host: dell01
  Connection handshake is completed
  [02-OCT-2007 12:18:20:863] nscon: sending NSPTCN packet
  [02-OCT-2007 12:18:23:547] nscon: got NSPTRS packet
  [02-OCT-2007 12:18:23:547] nscon: sending NSPTCN packet
  [02-OCT-2007 12:18:23:747] nscon: got NSPTAC packet
  Select is run
  [02-OCT-2007 12:18:47:861] nspsend: 00 00 00 00 00 E8 64 0B |......d.|
  [02-OCT-2007 12:18:47:861] nspsend: 01 2E 73 65 6C 65 63 74 |..select|
  [02-OCT-2007 12:18:47:861] nspsend: 20 68 6F 73 74 5F 6E 61 |.host_na|
  [02-OCT-2007 12:18:47:861] nspsend: 6D 65 2C 69 6E 73 74 61 |me,insta|
  [02-OCT-2007 12:18:47:861] nspsend: 6E 63 65 5F 6E 61 6D 65 |nce_name|
  [02-OCT-2007 12:18:47:861] nspsend: 20 66 72 6F 6D 20 76 24 |.from.v$|
  [02-OCT-2007 12:18:47:861] nspsend: 69 6E 73 74 61 6E 63 65 |instance|


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-625188-1-1.html 上篇帖子: winmail mail server的安装和使用方法 下篇帖子: DNS Server Installation Step by Step Using CentOS 6.5-Permanent
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表