当前位置:   article > 正文

Oracle RAC JDBC 配置

jdbc oracle rac 配置
我们都知道,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系统的代码:
  
 java demo
   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)
    )
  )
 


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31448824/viewspace-2139509/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/31448824/viewspace-2139509/

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/1006114
推荐阅读
相关标签
  

闽ICP备14008679号