0

美好时光!

首先,这是我的环境:

  • Java 1.7
  • 雄猫 7
  • Oracle UCP 连接池
  • 瘦 JDBC 驱动程序
  • 带有 RAC 和 SCAN 的 Oracle 10g 数据库(一些信息

我需要配置 Oracle FCF 功能。关于它的配置有几篇文章:Spring文档(1)完整示例(2),...

我已经执行了文章 (1) 中描述的所有步骤,并且我还配置了一个 UCP 日志记录,我可以在其中看到 FCF 实际已启用。

令我困惑的是第二篇文章的以下陈述:

FAST CONNECTION FAILOVER PREREQUISITES
...

 5.) The JVM in which your JDBC instance is running must have
 * oracle.ons.oraclehome set to point to your ORACLE_HOME. For example:
 * 
 * -Doracle.ons.oraclehome=C:\oracle\product\10.2.0\db_1

...

问题:

我的 Oracle 数据库 (RAC) 位于远程服务器上,并且我使用瘦 JDBC 驱动程序,因此我应该在这里做什么(我真的需要设置 uop 这个参数吗,如果是,那么如何设置)?第一篇文章没有关于配置这样一个JVM参数的意义,只是说我需要设置一个数据源的'ONSConfiguration'参数,我应该列出所有RAC节点......

更新 1:

同样来自第二篇文章:

CLIENT-SIDE ONS CONFIGURATION
...
(2) ONS daemon on the client side
Example ons.config file for a client:
...

在本文的开头,“客户端”是基于 Java 的应用程序,而“服务器端”是数据库 (RAC)。如果使用瘦 JDBC 驱动程序,是否真的需要在基于 java 的应用程序端创建“ons.config”文件?

UDPADE 2:来自Oracle 文档

Remote Configuration

UCP for JDBC supports remote configuration of ONS through the SetONSConfiguration pool property.    The ONS property value is a string that closely resembles the content of an ons.config file. The string contains a list of name=value pairs separated by a new line character (\n). The name can be: nodes, walletfile, or walletpassword. The parameter string should at least specify the ONS configuration nodes attribute as a list of host:port pairs separated by a comma. SSL would be used when the walletfile attribute is specified as an Oracle wallet file.

Applications that use remote configuration must set the oracle.ons.oraclehome system property to the location of ORACLE_HOME before starting the application. For example: java -Doracle.ons.oraclehome=$ORACLE_HOME ...

但是,当我没有本地安装 Oracle 数据库时,如何设置 ORACLE_HOME 变量,这就是瘦驱动程序的意义所在,对吧?

4

1 回答 1

1

如果你只想使用 UCP 池,那么你只需要这个设置:

PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
pds.setONSConfiguration("nodes=10.247.43.111:4500, 10.247.43.112:4500");
pds.setFastConnectionFailoverEnabled(true);

其中 "nodes=10.247.43.111:4500, 10.247.43.112:4500" 是 ons 监听器列表

10.247.43.111:4500 - 节点 1 上的远程监听器
10.247.43.112:4500 - 节点 2上的远程监听器
等。

看这个很好的例子:

http://www.idevelopment.info/data/Programming/java/jdbc/High_Availability/FastConnectionFailoverExampleThin.java

这个http://docs.oracle.com/cd/B19306_01/java.102/b14355/fstconfo.htm#CEGGDDFJ

本地 ONS 恶魔连接需要 ORACLE_HOME。

于 2015-01-14T08:02:57.390 回答