IBM Support

Oracle Error: ORA-01000 Maximum open cursors exceeded

Troubleshooting


Problem

How do you avoid the Oracle Error ORA-01000?

Resolving The Problem

Typically, in Java™, when an object goes out of scope, it is automatically garbage collected, but the Java specification does not place any specific requirements on the JVM regarding when (or even if) this will occur for any particular object. Therefore, do not rely on finalizers to close cursors. A finalizer is called when a class is garbage collected.

Explicitly close all cursors (for example ResultSet.close() and Statement.close()) when the cursors are no longer needed. This ensures that the corresponding server-side cursors are closed, preventing the ORA-01000 error.

The SQL_TEXT column can be queried in V$OPEN_CURSOR view to determine which cursors are not being closed. For example:

select sql_text from v$open_cursor;

Notes:

  1. Typically, close() statements should be put in a finally clause of the try block.
  2. There are known problems in certain versions of Oracle 8.1.6 JDBC drivers that can make this problem worse. The Oracle 8.1.7 JDBC driver or a later version should be used.

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"EJB Container","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF012","label":"IBM i"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"},{"code":"PF035","label":"z\/OS"}],"Version":"9.0;8.5.5;8.0;7.0","Edition":"Edition Independent","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSNVBF","label":"Runtimes for Java Technology"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Java SDK","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg21040875