0

我已经在 Oracle 数据库中实现了 datagaurd 以实现两台服务器的高可用性,并配置了 jdbc 设置以连接 Jboss 应用程序服务器以始终连接主数据库实例。

如果我使用以下字符串:

<connection-url>
jdbc:oracle:thin:@(DESCRIPTION=(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=3)(ADDRESS_LIST=(LOAD_BALANCE=OFF)(FAILOVER=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=<ip1>)(PORT=<port>))(ADDRESS=(PROTOCOL=TCP)(HOST=<ip2>)(PORT=<port>)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME
= MYDB)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC))))</connection-url>

当我执行切换/过滤时,ip1 已关闭,而 ip2 已启动。如果我在列表中首先指定 ip2,那么我会得到一个连接(就像我只是尝试连接到 ip2 时所期望的那样)。但是,当我首先放置 ip1 时,我会遇到与尝试直接连接到相同的错误

java.util.concurrent.ExecutionException: java.lang.RuntimeException:
java.sql.SQLException: ORA-01033: ORACLE initialization or shutdown
in progress
4

1 回答 1

0

带有 RAC 的 Data Guard 的推荐连接 URL 如下所示。您能确定您使用的是正确的连接 URL 吗?

jdbc:oracle:thin:@(DESCRIPTION = (FAILOVER=on)
     (CONNECT_TIMEOUT= 15) (RETRY_COUNT=20) (RETRY_DELAY=3)
       (ADDRESS_LIST =
           (LOAD_BALANCE=on)
           (ADDRESS = (PROTOCOL = TCP) (HOST=primary-scan) (PORT=1521)))
      (ADDRESS_LIST =
             (LOAD_BALANCE=on)
             (ADDRESS = (PROTOCOL = TCP) (HOST=secondary-scan) (PORT=1521))) 
      (CONNECT_DATA= (SERVICE_NAME = gold-cloud-service-name)))
于 2016-04-11T20:04:42.100 回答