刷到报废 发表于 2013-12-31 22:06:02

求解TAF对JDBC的支持情况和连接字符串标准写法

本帖最后由 刷到报废 于 2013-12-31 22:06 编辑


大家好,今天游走工地搬砖的时候发现一个问题,查了写资料,还是不太明白,这里向大伙儿恳求详解:

环境描述:
环境是Oracle Database 10.2.0.3的双节点RAC,部署的时候,DBCA顺手建了TAF,节点一首选,节点2是可用,TAF类型是BASIC,我没有做其他的配置,比如在数据库参数里配置local listner,
之后我给给客户端的tnsnames.ora粘贴了一份服务端的TAF部分,我可以用sqlplus或者pl/sql developer通过rac_taf连接上实例,
但是我没有做关闭节点看效果的测试.
粘贴一段配置RAC_TAF =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 100.86.000.00*)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 100.10.000.00*)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME =rac_taf)
      (FAILOVER_MODE =
        (TYPE = SELECT)
        (METHOD = BASIC)
        (RETRIES = 180)
        (DELAY = 5)
      )
    )
  )

之后客户的开发团队说他们的中间件weblogic在连上库之后,执行一两个操作,四五分钟,就会断开Io 异常: The Network Adapter could not establish the connection  用另外个service_name可以连,就是非taf的,service_name=rac,也是会断开,
报错如下:java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection他使用的连接字符串如下:jdbc:oracle:thin:(
DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS=(PROTOCOL=TCP)(HOST=100.86.000.00*)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=100.10.000.00*)(PORT=1521) )
(load_balance=yes)
(failover=yes) )
(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME= rac )
)
)(

还有:jdbc:oracle:thin:(
  DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 100.86.000.00*)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 100.10.000.00*)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac_taf)
      (FAILOVER_MODE =
        (TYPE = SELECT)
        (METHOD = BASIC)
        (RETRIES = 180)
        (DELAY = 5)
      )
    )
  )
我查了查资料,说10g的TAF不支持jdbc thin的方式连接,想向各位前辈求证一下这种说法的正确性?
以及11G和12C的支持情况,是不是如果用jdbc的话,服务端配置TAF就是没有意义的?
还有就是这个场景下,客户的weblogic的频繁断开会可能是什么原因?
这个链接字符串的标准写法是怎样的?因为看帖子说,就算不适用taf,字符串里面也是不需要写LB和FO这些参数的.
很迷惑,
如果各位有时间帮忙解答一下,有文档地址就更好了.
拜谢.(在辛苦发帖的时候...又断了...)

lunar 发表于 2013-12-31 22:36:30

FAQ: JDBC Drivers and Failover Mechanisms (FCF, TAF, SCAN) (Doc ID 1080674.1)

lunar 发表于 2013-12-31 22:42:21

你的问题,这个回答更加清晰吧:
Can the JDBC Thin Driver Do Failover by Specifying FAILOVER_MODE? (Doc ID 465423.1)

You have a 2-node RAC database. You ask if the JDBC Thin driver can do failover when using the following connect information.
jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1vip)(PORT = 1525)) (ADDRESS = (PROTOCOL =
TCP)(HOST = rac2vip)(PORT = 1525)) (LOAD_BALANCE = on)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ractest)
(FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 2) (DELAY = 1))))
FIX
No. JDBC Thin cannot use FAILOVER_MODE. The failover defined by FAILOVER_MODE is Transparent Application Failover (TAF). JDBC Thin does not support TAF.
However JDBC Thin does support Fast Connection Failover (FCF).

刷到报废 发表于 2013-12-31 23:16:04

lunar 发表于 2013-12-31 22:42 static/image/common/back.gif
你的问题,这个回答更加清晰吧:
Can the JDBC Thin Driver Do Failover by Specifying FAILOVER_MODE? (Do ...

那意思是JDBC的FO在TAF和FCF都不支持,那可以从连接字符串里面取消掉了吧?看到有的jdbc连接字符串里面还是会有一句fileover=yes?

lunar 发表于 2014-1-1 00:30:47

failover缺省就是yes,不带mode的一堆就是FCF,带了就是TAF,因此你的改为下面的,用FCF就行了吧:
jdbc:oracle:thin:(
  DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 100.86.000.00*)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 100.10.000.00*)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac_taf)
    )
  )

刷到报废 发表于 2014-1-1 20:16:13

lunar 发表于 2014-1-1 00:30 static/image/common/back.gif
failover缺省就是yes,不带mode的一堆就是FCF,带了就是TAF,因此你的改为下面的,用FCF就行了吧:
jdbc:or ...

小M多谢女神~
页: [1]
查看完整版本: 求解TAF对JDBC的支持情况和连接字符串标准写法