RAC JDBC 配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RAC JDBC 配置相关的知识,希望对你有一定的参考价值。
我们都知道,ORACLE 对外提供服务有 这么几种方式 THIN CONNECT ,OCI CONNECT ,DATALINK等数据连接方式。
1.THIN Connect
在单实例情况下,JDBC Connect String : jdbc:oracle:thin:10.11.1.243:1521/orcl
其中IP 10.11.1.243:1521 服务器IP地址和Lisener监听端口。
orcl 为数据服务名。
在RAC环境中,JDBC Connect String :
jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)
(HOST = 10.11.1.231)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)
(HOST = 10.11.1.232)(PORT = 1521))(LOAD_BALANCE = yes)(FAILOVER = ON)(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = racdb.its)(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RETIRES = 20)(DELAY = 15))))
其中HOST为两个几点的Lisener的配置。FAILOVER关键字 为配置故障切换。Load_balance为负载均衡打开设置。
SERVICE_NAME 为RAC系统的数据库实例名。
以下为JAVA系统的代码:
2.OCI 连接的配置 也就是通常的TNS 配置
单实例的情况:很简单 不多做累赘
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.11.1.243)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
RAC情况:
RACDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb1-vip.its)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb)
(INSTANCE_NAME = racdb1)
)
)
RACDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb1-vip.its)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb2-vip.its)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb)
)
)
LISTENERS_RACDB =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb1-vip.its)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb2-vip.its)(PORT = 1521))
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
RACDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb1-vip.its)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb2-vip.its)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb)
)
)
LISTENERS_RACDB =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb1-vip.its)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = racdb2-vip.its)(PORT = 1521))
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION = (ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
RACDB2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = racdb2-vip.its)(PORT = 1521)) (CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb)
(INSTANCE_NAME = racdb2)
)
)
转:http://www.cnblogs.com/jerryxing/archive/2012/10/17/2728061.html
以上是关于RAC JDBC 配置的主要内容,如果未能解决你的问题,请参考以下文章