10g rac vip漂移的目的不是让client不加改变的连接过来
而是让client尽快收到一个连接终止的包,然后由client去连接tnsnames中配置的下一个地址。
和没有vip相比, 使用vip可以减少由于db当机而引起的client等待。

oracle rac的vip真正作用不是让应用程序进行透明切换,应用程序还是必须自己配置多个监听ip才行,否则不能切换,配置多个vip,方法如下:在dblink中也要这么配置

1.应用程序连接Oracle rac的URL写法:

复制代码
 1 #Oracle(AMS)
 2 jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
 3 jdbc.url=jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.176.199)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.176.198)
 4 (PORT = 1521))(LOAD_BALANCE = yes)(FAILOVER = yes)(CONNECT_DATA =(SERVICE_NAME = kobra)(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RET
 5 IRES = 180)(DELAY = 5))))
 6 jdbc.username=kms
 7 jdbc.password=kms
 8 
 9 
10 #Oracle(Addon-KOBRA)
11 jdbc1.driverClassName=oracle.jdbc.driver.OracleDriver
12 jdbc1.url=jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.176.199)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.176.198
13 )(PORT = 1521))(LOAD_BALANCE = yes)(FAILOVER = yes)(CONNECT_DATA =(SERVICE_NAME = kobra)(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RE
14 TIRES = 180)(DELAY = 5))))
15 jdbc1.username=bond
16 jdbc1.password=bond
复制代码

 备注:如果使用scap ip,可以将以下代码直接替换成scan ip,形式为:jdbc:oracle:thin:@scap ip:1521:kobra

复制代码
1 (DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.176.199)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.176.198)
2 (PORT = 1521))(LOAD_BALANCE = yes)(FAILOVER = yes)(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = kobra)(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RET
3 IRES = 180)(DELAY = 15))))
4 (DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.176.199)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.176.198
5 )(PORT = 1521))(LOAD_BALANCE = yes)(FAILOVER = yes)(CONNECT_DATA =(SERVICE_NAME = kobra)(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RE
6 TIRES = 180)(DELAY = 15))))
复制代码

 2.客户端tnsnames.ora文件写法如下:

RACDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.18.1.7)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.18.1.8)(PORT = 1521))
      (LOAD_BALANCE = yes)
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = racdb)
      (FAILOVER_MODE =
        (TYPE = SELECT)
        (METHOD = BASIC)
        (RETRIES = 180)
        (DELAY = 5)
      )
    )
  )


复制代码

备注:同样,可以将以下ip地址用sacn ip或域名替来替换

复制代码
 1 ractest =
 2   (DESCRIPTION =
 3   (ADDRESS = (PROTOCOL = TCP)(HOST = scan-ip.localdomain)(PORT = 1521))
 4     (LOAD_BALANCE= yes)
 5     (FAILOVER= yes)
 6     (CONNECT_DATA = 8       (SERVICE_NAME = kobra)
 9     )
10   )
 posted on 2014-06-14 15:21  zmlctt  阅读(910)  评论(0编辑  收藏  举报