Showing posts with label ORA-010000. Show all posts
Showing posts with label ORA-010000. Show all posts

Tuesday, 11 September 2012

java.sql.SQLException: - ORA-01000: maximum open cursors exceeded

I answered a question on StackExchange about Oracle ORA-01000 errors. The answer raised more questions; the answer to the new questions raised more questions. So, here is a consolidated guide to ORA-010000. It assumes a working knowledge of Java, JDBC and SQL:

ORA-010000

ORA-01000, the maximum-open-cursors error, is an extremely common error in Oracle database development. In the context of Java, it happens when the application attempts to open more ResultSets than there are configured cursors on a database instance.

Common causes are:
  1. Configuration mistake
    • You have more threads in your application querying the database than cursors on the DB. One case is where you have a connection and thread pool larger than the number of cursors on the database.
    • You have many developers or applications connected to the same DB instance (which will probably include many schemas) and together you are using too many connections.
    • Solutions:
  2. Cursor leak
    • The applications is not closing ResultSets (in JDBC) or cursors (in stored procedures on the database). Cursor leaks are bugs and increasing the number of cursors on the DB simply delays the inevitable failure.
    • Solution: Fix the bug. Find leaks can be found using static code analysis, JDBC or application-level logging, and database monitoring.
More below the break...