无法从套接字读取更多数据错误
我们使用 Oracle 作为 Web 应用程序的数据库。应用程序在大多数情况下运行良好,但我们收到“没有更多数据可从套接字读取”错误。
Caused by: java.sql.SQLRecoverableException: No more data to read from socket
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1142)
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.T4C8Oall.doOALL(T4C8Oall.java:523)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:863)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1153)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1275)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3576)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3620)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1869)
at org.hibernate.loader.Loader.doQuery(Loader.java:718)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
at org.hibernate.loader.Loader.doList(Loader.java:2449)
... 63 more
我们使用 spring、hibernate,我的应用程序上下文文件中的数据源如下。
<bean class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close" id="dataSource">
<property name="driverClassName" value="${database.driverClassName}" />
<property name="url" value="${database.url}" />
<property name="username" value="${database.username}" />
<property name="password" value="${database.password}" />
<property name="defaultAutoCommit" value="false" />
<property name="initialSize" value="10" />
<property name="maxActive" value="30" />
<property name="validationQuery" value="select 1 from dual" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="poolPreparedStatements" value="true" />
<property name="removeAbandoned" value="true" />
<property name="logAbandoned" value="true" />
</bean>
我不确定这是因为应用程序错误、数据库错误还是网络错误。
我们在 oracle 日志中看到以下内容
Thu Oct 20 10:29:44 2011
Errors in file d:\oracle\diag\rdbms\ads\ads\trace\ads_ora_3836.trc (incident=31653):
ORA-03137: TTC protocol internal error : [12333] [4] [195] [3] [] [] [] []
Incident details in: d:\oracle\diag\rdbms\ads\ads\incident\incdir_31653\ads_ora_3836_i31653.trc
Thu Oct 20 10:29:45 2011
Trace dumping is performing id=[cdmp_20111020102945]
Thu Oct 20 10:29:49 2011
Sweep [inc][31653]: completed
Sweep [inc2][31653]: completed
Thu Oct 20 10:34:20 2011
Errors in file d:\oracle\diag\rdbms\ads\ads\trace\ads_ora_860.trc (incident=31645):
ORA-03137: TTC protocol internal error : [12333] [4] [195] [3] [] [] [] []
Incident details in: d:\oracle\diag\rdbms\ads\ads\incident\incdir_31645\ads_ora_860_i31645.trc
Thu Oct 20 10:34:21 2011
Oracle Version : 11.2.0.1.0
We are using Oracle as the database for our Web application. The application runs well most of the time, but we get this "No more data to read from socket" error.
Caused by: java.sql.SQLRecoverableException: No more data to read from socket
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1142)
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.T4C8Oall.doOALL(T4C8Oall.java:523)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:863)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1153)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1275)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3576)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3620)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1869)
at org.hibernate.loader.Loader.doQuery(Loader.java:718)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
at org.hibernate.loader.Loader.doList(Loader.java:2449)
... 63 more
We use spring, hibernate and i have the following for the datasource in my applciation context file.
<bean class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close" id="dataSource">
<property name="driverClassName" value="${database.driverClassName}" />
<property name="url" value="${database.url}" />
<property name="username" value="${database.username}" />
<property name="password" value="${database.password}" />
<property name="defaultAutoCommit" value="false" />
<property name="initialSize" value="10" />
<property name="maxActive" value="30" />
<property name="validationQuery" value="select 1 from dual" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="poolPreparedStatements" value="true" />
<property name="removeAbandoned" value="true" />
<property name="logAbandoned" value="true" />
</bean>
I am not sure whether this is because of application errors, database errors or network errors.
We see the following on the oracle logs
Thu Oct 20 10:29:44 2011
Errors in file d:\oracle\diag\rdbms\ads\ads\trace\ads_ora_3836.trc (incident=31653):
ORA-03137: TTC protocol internal error : [12333] [4] [195] [3] [] [] [] []
Incident details in: d:\oracle\diag\rdbms\ads\ads\incident\incdir_31653\ads_ora_3836_i31653.trc
Thu Oct 20 10:29:45 2011
Trace dumping is performing id=[cdmp_20111020102945]
Thu Oct 20 10:29:49 2011
Sweep [inc][31653]: completed
Sweep [inc2][31653]: completed
Thu Oct 20 10:34:20 2011
Errors in file d:\oracle\diag\rdbms\ads\ads\trace\ads_ora_860.trc (incident=31645):
ORA-03137: TTC protocol internal error : [12333] [4] [195] [3] [] [] [] []
Incident details in: d:\oracle\diag\rdbms\ads\ads\incident\incdir_31645\ads_ora_860_i31645.trc
Thu Oct 20 10:34:21 2011
Oracle Version : 11.2.0.1.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(14)
对于此类错误,您应该联系 Oracle 支持。不幸的是,您没有提及您正在使用什么 Oracle 版本。该错误可能与优化器绑定查看有关。根据 Oracle 版本的不同,适用不同的解决方法。
您有两种方法可以解决此问题:
_optim_peek_user_binds = false
当然,只有在oracle支持人员建议的情况下才应设置下划线参数
For errors like this you should involve oracle support. Unfortunately you do not mention what oracle release you are using. The error can be related to optimizer bind peeking. Depending on the oracle version different workarounds apply.
You have two ways to address this:
_optim_peek_user_binds = false
Of course underscore parameters should only be set if advised by oracle support
这是一个非常低级的异常,即ORA-17410。
发生这种情况的原因有多种:
暂时的网络问题。
JDBC 驱动程序版本错误。
特殊数据结构(数据库端)的一些问题。
数据库错误。
就我而言,这是我们在数据库上遇到的错误,需要修补。
如果这是网络问题并且您正在使用数据源(池),则重新启动它可能会作为解决方法。
This is a very low-level exception, which is ORA-17410.
It may happen for several reasons:
A temporary problem with networking.
Wrong JDBC driver version.
Some issues with a special data structure (on database side).
Database bug.
In my case, it was a bug we hit on the database, which needs to be patched.
If it is a networking issue and you are using a data source (pool), then restarting it may work as a workaround.
我们遇到了同样的问题,我们通过增加连接池的
initialSize
和maxActive
大小来解决它。您可以检查此链接
也许这对某人有帮助。
We were facing same problem, we resolved it by increasing
initialSize
andmaxActive
size of connection pool.You can check this link
Maybe this helps someone.
另一种情况:如果您要将日期参数发送到参数化 sql,请确保您发送的是
java.sql.Timestamp
而不是java.util.Date
。否则你会得到示例语句:
在我们的java代码中,我们使用
org.apache.commons.dbutils
并且我们有以下内容:在我们将日期参数更改为
java.sql.Timestamp
之前,上面的操作失败了。代码>Another case: If you are sending date parameters to a parameterized sql, make sure you sent
java.sql.Timestamp
and notjava.util.Date
. Otherwise you getExample statement:
In our java code, we are using
org.apache.commons.dbutils
and we have the following:The above was failing until we changed the date parameters to be
java.sql.Timestamp
尝试两件事:
java/jdk1.6.0_31/jre/lib/security/Java.security
中更改securerandom.source=file:/dev/urandom
代码> 到securerandom.source=file:///dev/urandom
Try two things:
java/jdk1.6.0_31/jre/lib/security/Java.security
changesecurerandom.source=file:/dev/urandom
tosecurerandom.source=file:///dev/urandom
我也有同样的问题。在以下情况下,我能够从应用程序端解决问题:
我使用的是数据库连接池
apache tomcat-jdbc
:可以采取以下配置参数作为参考:
此配置足以修复错误。在上述场景中,这对我来说效果很好。
有关设置 apache tomcat-jdbc 的更多详细信息: https://tomcat .apache.org/tomcat-7.0-doc/jdbc-pool.html
I had the same problem. I was able to solve the problem from application side, under the following scenario:
I used the database connection pooling
apache tomcat-jdbc
:You can take the following configuration parameters as a reference:
This configuration was sufficient to fix the error. This works fine for me in the scenario mentioned above.
For more details about the setup apache tomcat-jdbc: https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html
将 JRE 从 7 降级到 6 解决了这个问题。
Downgrading the JRE from 7 to 6 fixed this issue for me.
是的,正如 @ggkmath 所说,有时良好的旧重启正是您所需要的。就像“联系作者并让他重写应用程序,同时等待”不是一个选择。
当应用程序尚未以可以处理底层数据库重新启动的方式编写时,就会发生这种情况。
Yes, as @ggkmath said, sometimes a good old restart is exactly what you need. Like when "contact the author and have him rewrite the app, meanwhile wait" is not an option.
This happens when an application is not written (yet) in a way that it can handle restarts of the underlying database.
在我们的例子中,我们有一个查询,它使用 select * from x where Something in (...) 加载多个项目
这部分对于基准测试来说太长了。(17mb 作为文本查询)。查询有效,但文本太长。缩短查询解决了问题。
In our case we had a query which loads multiple items with select * from x where something in (...)
The in part was so long for benchmark test.(17mb as text query). Query is valid but text so long. Shortening the query solved the problem.
我收到此错误,然后重新启动了在客户端应用程序和数据库之间保存连接池的 GlassFish 服务器,错误就消失了。因此,如果适用,请尝试重新启动应用程序服务器。
I got this error then restarted my GlassFish server that held connection pools between my client app and the database, and the error went away. So, try restarting your application server if applicable.
我似乎通过删除参数化查询的参数占位符来修复我的实例。
由于某种原因,使用这些占位符工作正常,然后它们停止工作,我收到错误/错误。
作为解决方法,我用文字替换了占位符,它开始工作。
删除这个
使用这个
I seemed to fix my instance by removing the parameter placeholder for a parameterized query.
For some reason, using these placeholders were working fine, and then they stopped working and I got the error/bug.
As a workaround, I substituted literals for my placeholders and it started working.
Remove this
Use this
似乎是一个观点的问题。 JDBC 查询正在使用视图。我猜测了一下,重新编译了视图,错误消失了。
Seemed to be an issue with a view. JDBC query was using a view. I took a guess, recompiled the view and error is gone.
有时,当创建大量
语句
而没有关闭它们时,就会发生这种情况。因此,在 try catch 中使用如下语句:
它将自动关闭它们。
Sometimes it happen when lots of
statement
creation without close them.So use statement in try catch like:
It will auto close them.
就我而言,在 SQLdeveloper 中运行像这样的简单查询时会发生错误:
我解决了错误,所以......
In my case the error occurs running a simple query like this in SQLdeveloper:
I solved the error so...