简体   繁体   English

Oracle 11g连接重置错误

[英]Oracle 11g connection reset error

Am seeing the below error while trying to connect to Oracle 11g on Red Hat Linux, 64-bit using thin jdbc drivers. 在使用瘦jdbc驱动程序尝试连接到Red Hat Linux上的Oracle 11g时,我看到了以下错误。 Would highly appreciate if anyone can throw more light on how to go about troubleshooting this. 如果有人能够更多地了解如何解决这个问题,我们将非常感激。

 Caused by: java.net.SocketException: Connection reset
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
    at oracle.net.ns.DataPacket.send(DataPacket.java:199)
    at oracle.net.ns.NetOutputStream.flush(NetOutputStream.java:211)
    at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:227)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:175)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:100)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:85)
    at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:123)
    at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:79)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1122)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1099)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:288)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
    at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:366)
    at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:752)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:366)

We've had something very similar, moved a program from 32-bit to 64bit OS & a number of concurrent processes would throw the IO Error: Connection Reset. 我们有一些非常相似的东西,将程序从32位移动到64位操作系统和许多并发进程会引发IO错误:连接重置。

Stumbled across this which fixed it: 偶然发现它修复了它:

https://community.oracle.com/message/3701989 https://community.oracle.com/message/3701989

Basically add the -Djava.security.egd=file:/dev/./urandom parameter and it's good to go :) 基本上添加-Djava.security.egd = file:/ dev /./ urandom参数,这很好:)

I faced similar issue with Sqoop Oracle import and I have implemented the fix suggested by this link 我遇到了与Sqoop Oracle导入类似的问题,我已经实现了此链接建议的修复

This setting helped to resolve issue: 此设置有助于解决问题:

-Dmapred.child.java.opts="-Djava.security.egd=file:///dev/urandom"

and I've changed mapred-site.xml configuration property name value as: 我已将mapred-site.xml配置属性名称值更改为:

mapreduce.admin.map.child.java.opts -Djava.security.egd=file:///dev/urandom

This is a bit sqoop specific, but I think setting JVM option -Djava.security.egd=file:///dev/urandom" will help you to resolve issue. 这有点特定于sqoop,但我认为设置JVM选项-Djava.security.egd=file:///dev/urandom"将帮助您解决问题。

You didn't include any details of the problem like what changed? 你没有包含问题的任何细节,比如改变了什么? Is this a new configuration for you or did it suddenly stop working? 这是您的新配置还是突然停止工作? Do you know if you have enough connections available? 你知道你有足够的连接吗? Does this happen to every connection or is it intermittent? 这种情况是发生在每个连接上还是间歇性的?

Considering the error is occurring during the logon process, a few possibilities are: 考虑到登录过程中发生的错误,有几种可能性:

  1. Network fault 网络故障
  2. You have exhausted the maximum # of connections, so Oracle hangs up on you. 您已经耗尽了最多的连接数,因此Oracle会挂断您。
  3. Firewall restrictions 防火墙限制
  4. A problem with the database server or the listener. 数据库服务器或侦听器的问题。 The processing serving your session could be crashing after it's opened. 为您的会话提供服务的处理可能会在打开后崩溃。

Check the following stackoverflow thread about how to check the number of active connections and the max. 检查以下stackoverflow线程,了解如何检查活动连接数和最大值。 I would expect an "ORA-00018: maximum number of sessions exceeded" error if that were the problem, so it may not be. 如果这是问题,我会期望“ORA-00018:超出最大会话数”错误,因此可能不是。 But it's worth checking. 但值得一试。

How to check the maximum number of allowed connections to an Oracle database? 如何检查允许连接到Oracle数据库的最大数量?

由于堆栈未指示任何ORA,因此存在潜在的网络问题。

Other thing that was causing me this problem was having the HOSTNAME settings wrong. 导致我出现此问题的其他因素是HOSTNAME设置错误。 My connection attempt was hanged at: 我的连接尝试被绞死:

"main" prio=10 tid=0x00007f7cc8009000 nid=0x2f3a runnable [0x00007f7cce69e000]
   java.lang.Thread.State: RUNNABLE
        at java.net.Inet4AddressImpl.getLocalHostName(Native Method)
        at java.net.InetAddress.getLocalHost(InetAddress.java:1444)
        at sun.security.provider.SeedGenerator$1.run(SeedGenerator.java:176)
        at sun.security.provider.SeedGenerator$1.run(SeedGenerator.java:162)
        at java.security.AccessController.doPrivileged(Native Method)

So make sure you have an entry for your hostname in /etc/hosts/ . 因此,请确保在/etc/hosts/有一个主机名条目。

If you issue a hostname command like this: 如果您发出这样的hostname命令:

$ hostname
my.server.com

You need a line in your /etc/hosts : 你的/etc/hosts需要一行:

127.0.0.1 my my.server.com

Had the same problem - failed on Linux (sometimes), worked on Windows (always). 有同样的问题 - Linux(有时)失败,在Windows上工作(总是)。

Read about the reason (and the solution) on these sites: 了解这些网站上的原因(和解决方案):

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM