Oracle

关于Oracle RAC数据库的连接使用方法

日期:2015/6/28来源: IT猫扑网

  1、客户端hosts文件配置:

  10.19.65.167    sdwgrac1-vip

  10.19.65.169    sdwgrac2-vip

  注:unix平台是/etc/hosts;windows平台是C:\Windows\System32\drivers\etc\hosts。

  2、客户端tnsnames.ora配置:

  EOMS =

  (DESCRIPTION =

  (ADDRESS = (PROTOCOL = TCP)(HOST = sdwgrac1-vip)(PORT = 1521))

  (ADDRESS = (PROTOCOL = TCP)(HOST = sdwgrac2-vip)(PORT = 1521))

  (LOAD_BALANCE = yes)

  (CONNECT_DA TA =

  (SERVER = DEDICATED)

  (SERVICE_NAME = eoms)

  )

  )

  如上配置后,就可以在连接串里连接了,如:

  sqlplus name/passwd@eoms

  建议尽量使用eoms这个指定的数据库服务名来连接数据库。

  我们的应用必须使用这个服务名来连接数据库,以合理使用数据库的负载均衡功能。

  3、如果通过中间件进行连接,则URL应为:

  jdbc:oracle:thin:username/password@hostname:port/service_name

  jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = sdwgrac1-vip)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST=sdwgrac2-vip)(PORT = 1521))(LOAD_BALANCE = yes))(CONNECT_DATA=(SERVER = DEDICATED)(SERVICE_NAME = eoms)(FAILOVER_MODE =(TYPE =SELECT )(METHOD = BASIC)(RETRIES = 120)(DELAY = 5))))

相关文章

相关下载

网友评论

我要评论...
    没有更早的评论了
    取消