ORA-01000 超出打开游标的最大数
问题描述:
Caused by: java.sql.SQLException: ORA-01000: 超出打开游标的最大数
点击(此处)折叠或打开
- ORA-06512: 在 "PRD_OWNER1.PRD_PACKAGE1", line 810
- ORA-01000: 超出打开游标的最大数
- ORA-06512: 在 line 1
- machine1 > oerr ora 04025
- 04025, 00000, "maximum allowed library object lock allocated for %s%s%s%s%s"
- // *Cause: Too many active locks for the object has been allocated. This error
- // can be a result of too many cursors kept open per session.
- // *Action: Close cursors, reduce session_cached_cursors value.
问题分析:
这个问题很明显和游标相关,原来游标是300,先临时将open_cursors加到500了。
SQL> show parameter open_cursors
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
open_cursors integer 500
SQL>
经过检查发现代码有点问题,当条件成立发生时,没有关闭游标的操作。
在测试库重新运行该package,重现了该问题。
点击(此处)折叠或打开
- if r_count > 0 then
- DBMS_SQL.DEFINE_COLUMN (v_select_curid, 1, V_ID_ICM, 32);
- DBMS_SQL.DEFINE_COLUMN (v_select_curid, 2, V_CLIENT_NAME, 100);
- ......
- v_fund_status,
- v_fund_accound_date);
- END LOOP;
- DBMS_SQL.CLOSE_CURSOR(v_select_curid);
- end if;
- end search_client;