---
title: "使用Oracle遇到问题记录"
author: "tvmovie"
date: "2010-06-12T15:29:06Z"
tags: ["Oracle", "errorcode"]
categories: ["数据库"]
slug: "oracle"
draft: false
lastmod: "2020-06-28T18:00:17Z"
id: 690604
url: "https://coffeelover.iteye.com/blog/690604"
---

Q1 . 应用程序中执行批量更新时（where条件中有in），出现错误： ORA-01795 maximum number of expressions in a list is 1000

**原因：**in() 括号中值的个数有限制

**解决：**1) 调整应用程序处理，超过1000的分批更新。

            2) 是否可以通过调整数据库配置来解决？

*——2010-6-13部分已解决*

 

Q2 . 通过JDBC连接串进行连接时，出现错误：ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

**原因：**只配置了servicename，而没配sid

**解决：**在不修改oracle服务端配置的情况下，修改jdbc连接串：将jdbc连接串 @ 后的内容改为该连接的配置描述文字从 (DESCRIPTION  开始直到结束的所有内容（注意：要去掉换行），举例：

原jdbc连接串： jdbc:oracle:thin:@localhost:1521:test

修改后：jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost) (PORT=1521)) (CONNECT\_DATA =  (SERVER = DEDICATED)  (SERVICE\_NAME = test)  ))

            详见：[http://twit88.com/blog/2008/05/29/new-jdbc-url-syntax-for-oracle-10g-jdbc-driver/](http://twit88.com/blog/2008/05/29/new-jdbc-url-syntax-for-oracle-10g-jdbc-driver/)

*——2010-8-16已解决*

 

Q3 . 删除表时，出现错误： ORA 15264

**解决：**按 [drop table ora-600 15264](http://blog.chinaunix.net/uid-71225-id-2069320.html) 中所述进行操作。

*——2012-8-30已解决*

 

 

Q4 . Oracle XE 10g windows版本，java程序应用过程中，时有： ORA-12519 TNS:no appropriate service handler found

**解决：**see [http://blog.csdn.net/wyzxg/article/details/2154274](http://blog.csdn.net/wyzxg/article/details/2154274) 

                *——2012-10-09已解决*

 

Q . **2013-09**  生产环境遇到几个DB问题：

1)  Caused by: java.sql.SQLException: No more data to read from socket

        at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1157)

        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:290)

        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)

        at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)

        at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)

        at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:877)

        at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1167)

        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1281)

        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)

        at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3628)

        at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1205)

 

2\) 连接数据库时：IO Error: Connection reset

*一篇参考：[http://stackoverflow.com/questions/2327220/oracle-jdbc-intermittent-connection-issue](http://stackoverflow.com/questions/2327220/oracle-jdbc-intermittent-connection-issue)*

 

 **解决：加** -Djava.security.egd=file:/dev/./urandom

 see: https://www.usn-it.de/2009/02/20/oracle-11g-jdbc-driver-hangs-blocked-by-devrandom-entropy-pool-empty/

 

Q . **2013-09**  ORA-03111: break received on communication channel

**参考：**[http://blog.csdn.net/woohooli/article/details/6364831](http://blog.csdn.net/woohooli/article/details/6364831)

 

Q . **2013-09-13**  ORA-00903: invalid table name

**原因：**表名里含有Oracle关键字或非法字符。

 

Q . **2017-03-03**  网卡切换后进程僵死（jstack中显示oracle connection socket read）

**原因：**有若干线程处理任务，其中1个线程在进行batch操作，其他线程均在等待该线程任务执行完毕，

而在该batch操作过程中，网卡进行了切换，导致该DB连接实际上已经失效，而由于没有设置超时时间，

因此需要达到操作系统的网络超时时间才会触发异常。

**解决：**oracle jdbc连接属性中设置2个socket超时时间(单位ms)

```
	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
		<property name="url" value="" />
		<property name="username" value="" />
		<property name="password" value="" />
		<property name="connectionProperties" value="{oracle.net.CONNECT_TIMEOUT=60000;oracle.jdbc.ReadTimeout=60000}"/>
	</bean>
```

*参考：[深入理解JDBC的超时设置](http://chuansong.me/n/131038)*[](http://blog.csdn.net/woohooli/article/details/6364831)

 

Q . **2018-09-12** java.sql.SQLException: IO 异常: SO Exception was generated  
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)

**原因：**db连接串中间有空格

**解决：**去掉连接串中的空格