Oracle errors

ORA-01000: maximum open cursors exceeded

ORA-01000: maximum open cursors exceeded

One session has more cursors open than OPEN_CURSORS allows. This is usually a leak: the application does not close its statements or result sets. Fix the leak first; raising the limit only delays the error.

What ORA-01000 means

OPEN_CURSORS limits how many cursors a single session can hold open at the same time. It is a limit per session, not for the whole database. If an application opens a statement in a loop and never closes it, the count grows until ORA-01000 appears, often hours after the application started.

Common causes of ORA-01000

How to fix ORA-01000

  1. See which session and which SQL hold the cursors: V$OPEN_CURSOR.
  2. Close statements and result sets in a finally block or a try-with-resources construct.
  3. Close explicit and ref cursors in PL/SQL, including in the exception handler.
  4. Raise OPEN_CURSORS only if the count stays stable at a high level instead of growing.

ORA-01000 example

Which sessions hold the most cursors, and for which SQL?

SELECT sid, sql_text, COUNT(*) AS cursors
  FROM v$open_cursor
 GROUP BY sid, sql_text
 ORDER BY cursors DESC
 FETCH FIRST 20 ROWS ONLY;

Only if the load is real:

ALTER SYSTEM SET open_cursors = 1000 SCOPE = BOTH;

In SQLlightspeed

When a statement fails, SQLlightspeed’s error panel shows the error code with a plain-language explanation and a suggestion for what to do next, together with Oracle’s own message and a link to Oracle’s documentation — for this error and dozens of other common ones.

Related errors

ORA-00020ORA-04031ORA-03113 All Oracle errors →

Oracle documentation for ORA-01000. Oracle is a registered trademark of Oracle Corporation. SQLlightspeed is not affiliated with Oracle.