问题描述及解决办法ORA-01000 maximum open cursors exceededCause: A host language program attempted to open too many cursors. The initialization parameter OPEN_CURSORS determines the maximum number of cursors per user.Action: Modify the program to use fewer cursors. If this error occurs often, shut down Oracle, increase the value of OPEN_CURSORS, and then restart Oracle.

解决方案 »

  1.   

    这种情况遇到过n次,可能是程序里面的查询语句写的毛病,或是打开了多个连接,或是用了多个adpater
      

  2.   

    少用游标,用完后就CLOSE.尽量不要交叉使用游标.
      

  3.   

    老大们,能不能给点好的建议,请看原文中的“用查询语句select * from V$OPEN_CURSOR语句查询我的数据库中打开的游标数,结果显示公有46条sql语句”,就是说游标没有超????
      

  4.   

    用查询语句select * from V$OPEN_CURSOR语句查询我的数据库中打开的游标数,结果显示公有46条sql语句”
    它并不能准确地证明用了多少游标,它只能显示最近执行SQL语句的情况:
    1.检查程序代码,显式关闭游标
    2.修改'open_cursors' 参数,尽可能的大.
      

  5.   

    reference:
    http://www.cnoug.org/viewthread.php?tid=17870
      

  6.   

    ORA-01000 maximum open cursors exceeded24-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也应该在不再需要的时候关闭掉
      

  7.   

    上面的回复转贴自“doYouJ”,其实就是注意随时关闭(close())用过的preparedStatement、Statement、ResultSet