ORA-01000: 超出打开游标的最大数

wangxmwxm 2004-04-16 03:56:24
我用Jdbc连接Oracle数据库,程序运行一段时间就会出现此错误,我想知道游标在Jdbc是怎么理解的呢?是每次定义一个Resultset就产生一个,还是别的呢?
另外,这个问题一般是没有关闭Resultset,还是没有关闭Statement,还是别的怎么产生的呢?
...全文
152 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
flyincool 2004-04-27
  • 打赏
  • 举报
回复
oracle中控制游标数量由init*.ora决定,文件中有open_cursors控制游标的数量。
一般来说找init*.ora的命名规则是init+sid.ora
wuyaxlz 2004-04-26
  • 打赏
  • 举报
回复
我今天也遇到了这个问题,结果是执行存储过程没有关闭,结果关了后就好了
呵呵
zzymouse 2004-04-22
  • 打赏
  • 举报
回复
我们公司也出现了这种问题,解决方案有2种
1.在init.ora种加大open_cursors这个参数的值,然后重新启动数据库。
2.修改前台程式,记得一定要在程序里设置操作完成后关掉游标。
hpretty 2004-04-22
  • 打赏
  • 举报
回复
我们也有这种情况,我的办法是第二种,如果用第一种,只是延缓程序的死亡!
jiangchuanli 2004-04-22
  • 打赏
  • 举报
回复
两方面:
1, 修改源程序;
2,更改配置文件中的(我是oracle817版)open_cursors的最大数(需重启数据库)。
hey_you 2004-04-20
  • 打赏
  • 举报
回复
就是没有关闭ResultSet,打开一个ResultSet就在Oracle里打开一个游标。
江宁侯哥 2004-04-19
  • 打赏
  • 举报
回复
没有关闭Resultset,加大open_cursor只能延缓问题的出现。
doYouJ 2004-04-18
  • 打赏
  • 举报
回复
ORA-01000 maximum open cursors exceeded

24-July-2001
Author: Kavitha Soundararajan


--------------------------------------------------------------------------------

What causes this error?
This occurs when you open too many cursors.

--------------------------------------------------------------------------------

How to fix it
The initialization parameter OPEN_CURSORS in INITSID.ORA determines the maximum number of cursors per user.
Check the parameter specified by executing the following SQL:
select * from v$parameter
where name = 'open_cursors'
/

If you want more cursors to be opened at the same time, shut the database, change INITSID.ORA and restart the database.

The cursors that are counted for this are those explicit cursors that you opened and never closed or the cursors the PL/SQL keeps open. If you use a lot of stored procedures, then you will see lot of cached cursors. From release 8.1, PL/SQL will close these cached cursors on commit.

You can find the list of open cursors and the users who opened them by executing the following SQL:

select user_name, status, osuser, machine, a.sql_text
from v$session b,
v$open_cursor a
where a.sid = b.sid
/

But the above SQL will tell you about cursors opened at some point of time, but does tell you about currently open cursors. But the above SQL will helps us to track cursor leaks, which would need fixing, to avoid this error in the future.

The SQL given below will tell you how many are open truly.

select a.value, b.name
from v$mystat a, v$statname b
where a.statistic# = b.statistic#
and a.statistic#= 3
/

The closing of the cursor change based on the tool you use:

In JDBC, preparedStatement.close() does closes the cursor.
In PRO*C EXEC SQL CLOSE ; does it.
In OCI -- there is an API call to close a statement

These statements will make sure you close every explicitly opened cursor.

-----------------
ResultSet应该在用完后关闭
Statement也应该在不再需要的时候关闭掉
nebulaly 2004-04-18
  • 打赏
  • 举报
回复
加大open_cursor只能延缓问题的出现
LA003 2004-04-17
  • 打赏
  • 举报
回复
可能是连接打开太多了的原因
看看你的程序里面有没有循环建立连接的地方
wangxmwxm 2004-04-17
  • 打赏
  • 举报
回复
Why?
xbm2008 2004-04-16
  • 打赏
  • 举报
回复
修改你的参数文件中的 open_cursor的值为一个较大的数
wangxmwxm 2004-04-16
  • 打赏
  • 举报
回复
UP

17,090

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧