日期:2014-05-18  浏览次数:20690 次

ORACLE出现超出最大游标错误
ORACLE出现超出最大游标错误应该如何解决?

我的类里面所有的连接都有相应的关连接操作

写法如下

DBContent   db=null;
try
{
    db=new   DBContent();
    ......
}
  catch   (Exception   e)
{
    e.printStackTrace();
}
finally
{
    try
    {
        db.close();
    }   catch   (Exception   e)
    {
        e.printStackTrace();
    }
}


但是却报了ORACLE出现超出最大游标这个错误

我应该如何做才可以呢?

在页面上不存在开关数据库连接的代码

------解决方案--------------------
按照下面的进行确认:
1)确认OPEN_CURSORS的数量
SQL> show parameter open_cursors;

2)已经使用CURSOR的数量,这里使用 "SCOTT "用户
SQL> select o.sid, osuser, machine, count(*) num_curs
from v$open_cursor o, v$session s
where user_name = 'SCOTT ' and o.sid=s.sid
group by o.sid, osuser, machine
order by num_curs desc;

3)取得使用CURSOR的SQL语句,这里使用特定的SID=217
SQL> select q.sql_text
from v$open_cursor o, v$sql q
where q.hash_value=o.hash_value and o.sid = 217;

上面3步骤过后,就基本上找到哪个地方没有关闭Connection、Statement、ResultSet了.
所以,重点是找到代码中没关闭Connection、Statement、ResultSet 的地方.

Good luck