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 =(SERVER = DEDICATED)(SERVICE_NAME = kobra)(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RET 5 IRES = 180)(DELAY = 15)))) 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 =(SERVER = DEDICATED)(SERVICE_NAME = kobra)(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RE 14 TIRES = 180)(DELAY = 15)))) 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 =(SERVER = DEDICATED)(SERVICE_NAME = kobra)(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RE 6 TIRES = 180)(DELAY = 15))))
2.客户端tnsnames.ora文件写法如下:
1 ractest = 2 (DESCRIPTION = 3 (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.176.199)(PORT = 1521)) 4 (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.176.198)(PORT = 1521)) 5 (LOAD_BALANCE= yes) 6 (FAILOVER= yes) 7 (CONNECT_DATA = 8 (SERVER = DEDICATED) 9 (SERVICE_NAME = kobra) 10 ) 11 )
备注:同样,可以将以下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 = 7 (SERVER = DEDICATED) 8 (SERVICE_NAME = kobra) 9 ) 10 )