- 浏览: 568072 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (262)
- oracle (43)
- 打包 (3)
- linux (33)
- nginx (20)
- ftp (1)
- tomcat (8)
- mysql (22)
- plsql (4)
- jms (3)
- nosql (2)
- 运维监控 (5)
- 数据采集 (0)
- 测试 (2)
- jvm (5)
- 自动化数据库迁移 (2)
- 密码 (1)
- java代码 (7)
- java多线程,线程安全 (8)
- xml (1)
- spring (6)
- svn (2)
- oracle备份 (1)
- oracle 诊断 (3)
- oracle 归档 (4)
- java 虚拟机(JVM) (2)
- hibernate (5)
- activemq (2)
- http (2)
- linux_shell (9)
- python (3)
- ant (1)
- oracle rac (1)
- php (2)
- js (1)
- mongo (1)
- java 反射 (1)
- jira (1)
- 打包 maven (1)
- zabbix (2)
- lvs+keepalive (1)
- 防火墙 (1)
- memcache (2)
- redis (1)
最新评论
-
di1984HIT:
学习了~~~~
服务器大量TIME_WAIT -
springdata_spring:
可以参考最新的文档:如何在eclipse jee中检出项目并转 ...
maven常用命令 -
李小斌_2014:
我也遇到了,现在完美解决。
ORA-01422: 实际返回的行数超出请求的行数 -
啸风8023:
...
tomcat启动报错 -
fke153:
这个问题确实很坑人啊,学习了
ORA-01422: 实际返回的行数超出请求的行数
1、按顺序尝试每个地址,直到有一个成功 tnsnames.ora 里面的配置是这样的 RAC = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.102.202)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.102.200)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = sun) ) ) 默认情况下,LOAD_BALANCE=no,FAILOVER=true,SOURCE_ROUTE=no 2、随机尝试每个地址,直到成功 tnsnames.ora 里面的配置是这样的 RAC = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.102.202)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.102.200)(PORT = 1521)) (LOAD_BALANCE = yes) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = sun) ) ) 3、随机选择尝试一个地址 tnsnames.ora 里面的配置是这样的 RAC = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.102.202)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.102.200)(PORT = 1521))) (LOAD_BALANCE = yes) (FAILOVER = false) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = sun) ) ) 4、按顺序使用每个地址,直到到达目标 tnsnames.ora 里面的配置是这样的 RAC = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.102.202)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.102.200)(PORT = 1521)) (SOURCE_ROUTE = yes) (FAILOVER = false) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = sun) ) ) 5、只使用第一个地址 RAC = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.102.202)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.102.200)(PORT = 1521)) (FAILOVER = false) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = sun) ) )
根据网上的提示
jdbc:oracle:thin@(DESCRIPTION =(ADDRESS_LIST=(ADDRESS=(PROTOCOL = TCP)(HOST = 192.168.102.202)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.102.200)(PORT = 1521))(LOAD_BALANCE = no)(FAILOVER=YES))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = jrtdbtest))) 或者 core.db.url=jdbc:oracle:thin@(DESCRIPTION =(ADDRESS_LIST=(ADDRESS=(PROTOCOL = TCP)(HOST = dbserver1-vip)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = dbserver2-vip)(PORT = 1521))(LOAD_BALANCE = no)(FAILOVER=YES))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = jrtdbtest))) 报错:java.sql.SQLException: Io exception: NL Exception was generated 根据实验,居然是url中的空格引起的
通过网络查找及查询数据库,数据库的rac信息如下:
"./10g/db/network/admin/tnsnames.ora" 40 lines, 1003 characters # tnsnames.ora Network Configuration File: /oracle/10g/db/network/admin/tnsnames.ora # Generated by Oracle configuration tools. LISTENERS_JRTDB = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver1-vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver2-vip)(PORT = 1521)) ) JRTDB2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver2-vip)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = jrtdb) (INSTANCE_NAME = jrtdb2) ) ) JRTDB1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver1-vip)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = jrtdb) (INSTANCE_NAME = jrtdb1) ) ) JRTDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver1-vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver2-vip)(PORT = 1521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = jrtdb) ) ) :q [jrtdb2]@dbserver2[/oracle]$ping dbserver1-vip PING dbserver1-vip: (192.168.102.201): 56 data bytes 64 bytes from 192.168.102.201: icmp_seq=0 ttl=255 time=0 ms 64 bytes from 192.168.102.201: icmp_seq=1 ttl=255 time=0 ms ----dbserver1-vip PING Statistics---- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max = 0/0/0 ms [jrtdb2]@dbserver2[/oracle]$vi /etc/hosts "/etc/hosts" [Read only] 61 lines, 2096 characters # @(#)47 1.1 src/bos/usr/sbin/netstart/hosts, cmdnet, bos530 7/24/91 10:00:46 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos530 src/bos/usr/sbin/netstart/hosts 1.1 # # Licensed Materials - Property of IBM # # (C) COPYRIGHT International Business Machines Corp. 1985,1989 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # # COMPONENT_NAME: TCPIP hosts # # FUNCTIONS: loopback # # ORIGINS: 26 27 # # (C) COPYRIGHT International Business Machines Corp. 1985, 1989 # All Rights Reserved # Licensed Materials - Property of IBM # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # /etc/hosts # # This file contains the hostnames and their address for hosts in the # network. This file is used to resolve a hostname into an Internet # address. # # At minimum, this file must contain the name and address for each # device defined for TCP in your /etc/net file. It may also contain # entries for well-known (reserved) names such as timeserver # and printserver as well as any other host name and address. # # The format of this file is: # Internet Address Hostname # Comments # Items are separated by any number of blanks and/or tabs. A '#' # indicates the beginning of a comment; characters up to the end of the # line are not interpreted by routines which search this file. Blank # lines are allowed. # Internet Address Hostname # Comments # 192.9.200.1 net0sample # ethernet name/address # 128.100.0.1 token0sample # token ring name/address # 10.2.0.2 x25sample # x.25 name/address 127.0.0.1 loopback localhost # loopback (lo0) name/address # Public Network - (eth0) 192.168.102.200 dbserver1 192.168.102.202 dbserver2 # Private Interconnect - (eth1) 192.168.103.200 dbserver1-priv 192.168.103.202 dbserver2-priv # Public Virtual IP (VIP) addresses 192.168.102.201 dbserver1-vip 192.168.102.203 dbserver2-vip
最终修改如下,网上还说不能用ip,但是测试用ip通过,如果用主机名的话,需要在etc/host下添加
jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS=(PROTOCOL=TCP)(HOST=dbserver1-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=dbserver2-vip)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=jrtdb))) jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.102.200)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.102.202)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=jrtdb)))
LOAD_BALANCE FAILOVER ON ON 客户端新建连接随机尝试ADDRESS_LIST中的监听,直到连接到一个可用监听,或者连完列表中的所有监听,如没有一个监听可用,则返回错误信息 ON OFF 客户端新建连接随机尝试ADDRESS_LIST中的任一监听,无论这个监听是否可用,如不可用直接返回错误。 OFF ON 客户端新建连接按顺序尝试ADDRESS_LIST中的监听,直到连接到一个可用监听,或者连完列表中的所有监听如没有一个监听可用,则返回错误信息 OFF OFF 客户端新建连接仅连接ADDRESS_LIST中第一个监听,无论这个监听是否可用,如不可用直接返回错误。
数据源连接数据库问题
最开始用的是dbcp连接数据库的,如下:
<bean id="coreDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${core.db.driver}" /> <property name="url" value="${core.db.url}"/> <property name="username" value="${core.db.username}" /> <property name="password" value="${core.db.password}" /> <property name="maxActive"><value>200</value></property> <property name="initialSize"><value>20</value></property> <property name="maxWait"><value>600</value></property> <property name="maxIdle"><value>20</value></property> <property name="minIdle"><value>3</value></property> <property name="removeAbandoned"><value>true</value></property> <property name="removeAbandonedTimeout"><value>180</value></property> <property name="validationQuery"><value>select 1 from dual</value></property>
但是换了之后第一次连接失败,往后连接正出常,换了驱动也是一样,不知道怎么回事,是否是dbcp的bug,换了数据源后,该问题解决,如下Bonecp
<!-- BoneCP数据源配置 --> <bean id="coreDataSource" class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close"> <property name="driverClass" value="${core.db.driver}" /> <property name="jdbcUrl" value="${core.db.url}"/> <property name="username" value="${core.db.username}" /> <property name="password" value="${core.db.password}" /> <!-- 检查数据库连接池中空闲连接的间隔时间,单位是分,默认值:240,如果要取消则设置为0 --> <property name="idleConnectionTestPeriod" value="60" /> <!-- 连接池中未使用的链接最大存活时间,单位是分,默认值:60,如果要永远存活设置为0 --> <property name="idleMaxAge" value="240" /> <!-- 每个分区最大的连接数 --> <property name="maxConnectionsPerPartition" value="20" /> <!-- 每个分区最小的连接数 --> <property name="minConnectionsPerPartition" value="3" /> <!-- 分区数 ,默认值2,最小1,推荐3-4,视应用而定--> <property name="partitionCount" value="3" /> <!-- 每次去拿数据库连接的时候一次性要拿几个,默认值:2 --> <property name="acquireIncrement" value="5" /> <!-- 缓存prepared statements的大小,默认值:0 --> <property name="statementsCacheSize" value="10" /> <!-- 每个分区释放链接助理进程的数量,默认值:3,除非你的一个数据库连接的时间内做了很多工作,不然过多的助理进程会影响你的性能 --> <property name="releaseHelperThreads" value="3" />
经测试发现,所有的参数应该是off,on如下:
jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.150.203)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.150.201)(PORT=1521)))(SOURCE_ROUTE = off)(FAILOVER = on)(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=jrtdb)))
注:ip地址是rac虚拟地址
发表评论
-
ORA-28001: the password has expired
2016-05-23 10:28 864来源 http://blog.csdn.net/jrq/art ... -
oracle 索引未生效
2016-05-06 12:17 1787不走索引大体有以下几个原因: • 你在Instance级 ... -
通过sid查找sql
2016-05-05 11:08 1555这是当前运行的sql语句 select sid, ... -
oracle 表空间满
2016-03-26 18:24 1471今天Oracle的表空间突然满了,建表的时候是自动扩展,但还是 ... -
ORA-00030: User session ID does not exist
2016-02-17 16:53 2720Oracle进程被KILL之后,状态被置为" ... -
Oracle 用户表空间查看、修改大小、设置自增长等
2016-01-22 15:58 1303首先登入某个用户,查看某个用户在哪个表空间下: ... -
oracle 各种授权
2015-12-07 10:57 646alter any cluster 修改任 ... -
打造上千万长连接及oracle调优
2014-02-23 20:29 1234... -
oracle uuid生成
2014-02-10 09:30 855CREATE TABLE TEST( ID VARCHA ... -
oracle 字符乱码
2013-11-27 09:42 1691文章来源http://blog.csdn.net/nini11 ... -
oracle 备份
2013-11-05 14:59 883全备份(0级备份) $ vi lev0_bak.sh # ... -
查看用户权限
2013-10-15 11:23 7531、查看所有用户 select * from d ... -
oracle 索引类型
2013-06-07 18:36 955附件是oracle索引的类型 -
oracle表空间利用率
2013-02-22 10:34 975SELECT * FROM ( SELECT D.TA ... -
aix系统cpu使用率过高
2012-10-29 14:11 6328今天发现oracle的cpu使用率过高,由于机器上只要orac ... -
oracle 索引监控
2012-10-24 13:51 1018oracle 索引监控 打开索引 alter in ... -
oracle修改字符集
2012-08-31 14:38 1053oracle修改字符集 查询oracle server端 ... -
oracle 触发器 new ,old
2012-08-27 11:28 1010特性 INSERT UPDATE DELE ... -
oracle PGA SGA
2012-08-03 22:54 1400PGA与SGA的分配 _________________ ... -
ORACLE查看并修改最大连接数
2012-07-25 09:43 2894文章来源http://hi.baidu.com ...
相关推荐
而"jdbc_admin.pdf"可能是关于JDBC管理和配置的文档,对理解JDBC连接和配置数据源会有帮助。 总结来说,配置WebLogic连接Oracle RAC数据源是一个涉及多个层面的过程,包括JDBC驱动的管理、数据源的创建和配置、高...
标题提到的"可用于Oracle19c的JDBC驱动"指的是Oracle公司为19c版本数据库提供的Java Database Connectivity (JDBC)驱动程序,它允许Java应用程序通过网络连接到Oracle数据库,执行SQL语句、处理结果集等操作。...
### RAC Oracle JDBC 配置详解 #### 一、引言 在当今的企业级应用环境中,Oracle RAC(Real Application Clusters)作为一种高可用性和高性能的解决方案被广泛采用。RAC通过在一个集群中运行多个数据库实例来实现...
Spring Boot 连接 Oracle 数据库 JDBC 配置步骤 在本文中,我们将详细介绍如何使用 Spring Boot 连接 Oracle 数据库,配置 JDBC 驱动程序,并实现数据库的基本操作。 Step 1: 添加依赖项 在 Spring Boot 项目中,...
在 RAC 中,负载均衡分为两种,一种是基于客户端连接的,另外一种是基于服务器端的。下面将详细介绍基于客户端连接的负载均衡配置。 一、客户端负载均衡的配置 在客户端配置 TNS 时,需要在 tnsnames.ora 中添加 ...
在WebLogic环境中配置Oracle RAC数据库连接时,正确设置JDBC连接字符串和TNSNAMES.ORA文件是非常重要的。这些配置确保了WebLogic Server能够高效地与Oracle RAC数据库进行交互,并充分利用其提供的高级特性。
本篇将深入讲解如何使用JDBC连接驱动,以及涉及到的MySQL和Oracle数据库的相关知识。 首先,我们关注的是两个具体的JDBC驱动文件:“mysql-connector-java-5.1.38-bin.jar”和“ojdbc6.jar”。这两个文件是数据库...
本文将详细介绍使用JDBC连接Oracle数据库的三种URL格式,并通过示例代码解释它们的工作原理。 首先,我们需要理解JDBC URL的基本结构,它通常遵循这样的模式:`jdbc:driver_type:connection_protocol:@server[:port...
本篇文章将深入探讨Oracle 11g JDBC连接的相关知识。 一、Oracle 11g JDBC驱动 Oracle 11g提供了多种JDBC驱动,主要包括以下几种: 1. JDBC Thin Driver:这是一个轻量级的纯Java驱动,不依赖于任何Oracle客户端库...
Java数据库连接(JDBC)API是一系列能够让Java编程人员访问数据库的接口,各个开发商的接口并不完全相同。在使用多年的Oracle公司的JDBC后,我积累了许多技巧,这些技巧能够使我们更好地发挥系统的性能和实现更多的...
为了确保高可用性,Oracle 11g RAC 提供了两种连接失败转移机制:TAF (Transparent Application Failover) 和 FCF (Fast Connect Failover)。 ##### 1. TAF (透明应用程序故障转移) TAF 允许 Oracle Net 自动将...
- **JDBC 驱动程序**:确保使用的 JDBC 驱动程序支持 XA 事务处理,并且与 Oracle RAC 数据库兼容。正确的驱动程序版本是实现稳定、高效数据访问的关键。 - **Oracle RAC 数据库**:Oracle Real Application ...
1. **JDBC连接池配置** - **配置连接池 FOR WEBLOGIC 8.1**:在WebLogic 8.1中,管理员可以通过管理控制台或XML配置文件来创建和配置JDBC数据源,设置连接池大小、超时参数、验证机制等。配置步骤包括定义JDBC数据...
4. ** JDBC Universal Driver**:Oracle JDBC Universal Driver是一个多协议驱动,能够与Oracle数据库的不同版本和部署模式(例如,RAC、Dataguard等)兼容。 在Oracle 12c的JDBC全量包中,你会找到适用于不同JDK...
第6章 RAC的高可用性连接 6.1 Oracle Net Service 6.1.1 Oracle Net结构 6.1.2 Oracle Net命名方法 6.1.3 Oracle Net工作原理 6.1.4 Oracle Net Listener工作原理 6.1.5 JDBC工作原理 6.2 Oracle高可用性连接...
Oracle JDBC驱动支持连接池和RAC的负载均衡,使得应用能够透明地利用RAC的特性。 总之,部署Oracle 19c RAC on Linux是一项涉及多个层面的工作,需要对Linux系统、网络配置、Oracle数据库及Java应用有深入理解。每...