Exception thrown like ORA-01000

Hi,
I am getting the error in my java code like ORA-01000.
Exception :ORA-01000: maximum open cursors exceeded
How to check through code whether the cursor is opened or closed.
Can anyone please help me to resolve this incident?.

SHAHID HUSSAIN ABRO wrote:
ERROR:
ORA-01000: Maximum open cursors exceeded
SOLUTIONS:
SQL> show parameter cursor_;
SQL> alter system set open_cursor=1000;
Or
SQL> alter system set open_cursor=1000 scope=spfile;
SQL> SHUT immediate
SQL> STARTUP;
SQL> show parameter cursor_;
Shahid Hussain Abro
Assistant Commissioner, SRBIf you are suggesting that the solution is to modify the database to allow more open cursors then you are almost certainly wrong.
Posters here do not have a problem with applications that need to use more cursors. What they have is a failure to properly close the cursors that they do use. And your solution will not correct that problem and could even make it worse as cursors require system resources.
Worse it could end up hiding the problem because the application with volume X might operate for some time, but then start failing because the volume goes above X and by then no one remembers that the wrong solution was applied.

Similar Messages

  • ORA-01000

    Hi Guys,
    I am getting ORA-01000 exception. When am extracting the data's from Excel file and upload it into database.
    In that file am having nearly 250 records, i can load only 298 after that the Exception is thrown like ORA-01000.
    Can anyone help me resolve this incident?
    Thanks in advance

    Dhiva wrote:
    I am getting ORA-01000 exception. When am extracting the data's from Excel file and upload it into database.
    In that file am having nearly 250 records, i can load only 298 after that the Exception is thrown like ORA-01000.Your Java code is broken. This is not an Oracle problem. This is Oracle complaining about resource abuse by the client.
    On the client:, the basics are:
    - re-use a cursor handle for performance (no need for extra soft or hard parsing)
    - close a cursor handle when done
    Not closing cursor handles in Oracle that your client code created, leads to an ever increasing number of open cursors for that client session in Oracle. Fortunately Oracle implements a ceiling on this type of abuse, throws an exception when this ceiling is reached, and refuses to simply waste more resources by simply creating more and more cursors in that session.
    Fix your code. Oracle is working as designed and as documented.

  • ORA-01000: maximum open cursors exceeded--Error

    Hi
    What is "ORA-01000: maximum open cursors exceeded" error,How to solve.
    Thanks
    Miseba

    Hi
    ORA-01000: maximum open cursors exceeded
    Other terms
    Oracle, open cursors, exchange infrastructure
    Reason and Prerequisites
    The parameter "open_cursors" is set too low. Long transactions, such as imports, may use up all available cursors and fail.
    Solution :
    THIS NOTE APPLIES TO XI 3.0 SP2 ONLY **
    if you encounter an exception that reports "ORA-01000: maximum open cursors exceeded" please adjust the open_cursors parameter as follows:
    If the BR*Tools exist on your system:
    1] directory: /usr/sap/<SID>/SYS/exe/run
    2] "brspace -c force -f dbparam -a change -p open_cursors -v 100000"
    3] directory: $ORACLE_HOME/dbs (Unix) or %ORACLE_HOME%/database (Win)
    4] change open_cursors parameter in init<SID>.ora to 100000
    If the BR*Tools are not available (2] above - command not found)
    1] change the open_cursors parameter as in 4] above
    2] restart DB, for changes to take effect. _ NOTE: This problem has been fixed with XI 3.0 SP3 (see note 735078)
    Plz asign points if helpfull.
    Regards
    Padmanabha

  • Not closing ResultSet, but not getting ORA-01000

    I have an application that is generating the familiar ORA-01000 error.
    Whilst investigating the problem, I wrote a small test program. In the test program I tried to get the ORA-01000, but I don't get it (has anyone ever complained about not getting ORA-01000 before?!)
    connection = DriverManager.getConnection("<connection string>");
    String sql = "SELECT c1 FROM pdtab2 WHERE Id>=? AND Id<=?";
    PreparedStatement ps = connection.prepareStatement(sql);
    for (int i = 1; i <= 30000; ++i)
        ps.setInt(1, i-1);
        ps.setInt(2, i+1);
        if (i % 100 == 0)
            System.out.println("i=" +i);
            System.out.println("getCurrentOpenCursors(connection)="
                               +getCurrentOpenCursors(connection));
        try
            rs = ps.executeQuery();
            while (rs.next())
                result = rs.getInt(1);
        catch (SQLException e2)
            e2.printStackTrace();
        finally
            // Do nothing! Do not close the result set
    }getCurrentOpenCursors does:
    select count(*) AS COUNT from v$open_cursor where user_name like 'me'
    I have reduced OPEN_CURSORS down from 300 to 100, but getCurrentOpenCursors always returns less that what it is set to. Suggesting that OPEN_CUSRORS is not a limit, but rather a pool size?
    The result set returns more than one record, I never close the result set, yet I do not get an ORA-01000 error. I have tried auto-commit true and false on the connection. Is the prepared statement closing its previous result set on each new iteration of the loop, hence stopping me getting a problem?
    I am using Oracle version 10.2.0.1, the corresponding ojdbc14.jar, and Java 1.4.
    Thanks,
    Paul

    Here is a program that does that for you.
    To fix the program, un-comment the line 24 of the code and run again.
    C:\> type TestCursors.java
    import java.lang.* ;
    import java.util.* ;
    import java.sql.* ;
    import oracle.jdbc.* ;
    public class TestCursors
        public static void main(String[] args) throws SQLException, ClassNotFoundException
            Class.forName("oracle.jdbc.driver.OracleDriver");
            Connection connection = DriverManager.getConnection("jdbc:oracle:oci:@localhost:1521:ORCL");
            ResultSet rs ;
            PreparedStatement ps ;
            for (int i = 1; i <= 30000; ++i)
                String sql = "SELECT 20 FROM scott.emp WHERE deptno = ?";
                ps = connection.prepareStatement(sql);
                ps.setInt(1, 10);
                try
                    rs = ps.executeQuery();
                    rs.close() ;
                    //ps.close() ;
                catch (SQLException e2)
                    System.out.println("The value if i is " + i) ;
                    throw e2 ;
    C:\> javac TestCursors.java
    C:\> java TestCursors
    The value if i is 301
    Exception in thread "main" java.sql.SQLException: ORA-01000: maximum open cursors exceeded
            at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
            at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:671)
            at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:597)
            at oracle.jdbc.driver.T2CPreparedStatement.executeForDescribe(T2CPreparedStatement.java:570)
            at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1030)
            at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1123)
            at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3284)
            at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3328)
            at TestCursors.main(TestCursors.java:22)
    C:\>

  • Cannot figure out why "ORA-01000 Maximum open cursors" is shown...

    Hello there ...
    I am programming a PL/SQL Code that is throwing 0RA-01000 Maximum Open Cursors Exceeded.
    Having already read quite a lot about ORA-01000 errors, I know I should be closing cursors, and have already tried setting OPEN_CURSORS parameter to a high number (1000).
    I declared a lot of procedures in my pl/sql, each of which uses one cursor since i am working with a non-Oracle table linked by ODBC ... and each procedure sometimes does thousands of inserts -- but all WITHIN the explicit cursors. The explicit cursors are not declared within each loop.
    I already checked the code many times, and made sure all open cursors are closed. In addition, I also verified the numberopen cursors generated by the PL/SQL by running the following SQL after every procedure i run... and outputting it... and it appears the value just keeps on increasing, even though I had explicitly closed all the cursors in all the earlier procedures.
    What is funny is that the most number of cursors reported by the code below only hits 150+ cursors. Nowhere near the 1000 open_cursors limit per session.
    select a.value into strtxt --, b.name        
            from v$mystat a, v$statname b
            where a.statistic# = b.statistic#
            and a.statistic#= 3;When I run the procedures separately though, all the procedures run smoothly (even when I had not yet updated the open_cursors parameter).
    I was thinking of the following, but maybe you have some other ideas?
    Does this have anything to do with my procedures not being stored procedures?
    Or should i be committing records within my procedures instead of out of it?
    I really have run into a wall and would really appreciate any tips or helps on this. Thanks in advance!
    My basic pl/sql code looks like below. I did not give the actual details cause it will be too long (up to 5000 lines).
    DECLARE
    PROCEDURE proc1
    IS
        CURSOR cur_hca
           is
               select ...from..where;
       TYPE cur_hca_fetch
            Is TABLE OF cur_hca%ROWTYPE
                INDEX BY PLS_INTEGER;
        temp_collect cur_hca_fetch;
    BEGIN
       open cur_hca;         --cur_hca is the cursor name.
                                      --i use exactly the same cursor name in the other procedures
          loop
             fetch cur_hca bulk collect into temp_collect LIMIT 1000;
             exit when temp_collect.count=0
             for indx in 1 .. temp_collect.count
                loop
                  ...run some sql
                end loop;
          end loop;
      close cur_hca;
    END proc1;
    PROCEDURE proc2   --almost the same as above the only changes are the query for the
                                 -- cursor and the sql that happens for each record
    IS
    BEGIN
       open cur_hca;         --cur_hca is my cursor name
          loop
          end loop;
      close cur_hca;
    END proc2;
    ... up to 40 other very similar procedures
    BEGIN
       proc1;
       commit;
       select a.value into strtxt
            from v$mystat a, v$statname b
            where a.statistic# = b.statistic#
            and a.statistic#= 3;
      DBMS_OUTPUT.PUT_LINE('Number of Cursors After STATUSproc1: ' || strtxt); 
       proc2;
       commit;
       select a.value into strtxt
            from v$mystat a, v$statname b
            where a.statistic# = b.statistic#
            and a.statistic#= 3;
       DBMS_OUTPUT.PUT_LINE('Number of Cursors After STATUSproc2: ' || strtxt); 
       ... 40 other procedures
    END;Edited by: user4872285 on May 6, 2013 6:49 PM
    Edited by: user4872285 on May 6, 2013 7:01 PM
    Edited by: user4872285 on May 6, 2013 8:02 PM
    Edited by: user4872285 on May 6, 2013 8:03 PM

    PL/SQL code usually leaks reference cursors and DBMS_SQL cursors - as the ref cursor/DBMS_SQL interface used has a global (session static) scope.
    PL/SQL has an intelligent garbage collector that will close local implicit and explicit cursors, when the cursor variable goes out of scope.
    If you define an explicit cursor globally (package interface), then it can only be opened once. The 2nd attempt results in a ORA-06511: PL/SQL: cursor already open exception. So code cannot leak explicit cursors as code cannot reopen an existing opened explicit cursor.
    I have never seen Oracle leaking cursors internally. So I would be hesitant to call what you are seeing, a bug. If your code is using explicit cursors (even static/global ones), your code cannot leak these cursors, even if your code does not close them. Worse case - the cursor remains open, however new copies cannot be created while it is open.
    So I think your are looking at the wrong thing - explicit cursors. These are not the cursors that are leaking in my view (simply because code cannot reuse and open an already opened explicit cursor). Here is an example:
    SQL> show parameter cursors
    NAME                                 TYPE        VALUE
    open_cursors                         integer     300
    session_cached_cursors               integer     50
    // procedure that seems to "leak" an explicit cursor handle
    // as it does not explicitly closes the handle
    SQL> create or replace procedure CursorUse is
      2          cursor c is select e.* from emp e;
      3          empRow  emp%RowType;
      4  begin
      5          open c;
      6          fetch c into empRow;
      7          --// not closing explicit cursor handle
      8          --// and going out-of-scope
      9  end;
    10  /
    Procedure created.
    // current session stats
    SQL> select b.name, a.value from v$mystat a, v$statname b where a.statistic# = b.statistic# and b.name like '%open%cursor%';
    NAME                                  VALUE
    opened cursors cumulative                91
    opened cursors current                    2
    // execute proc that "leaks" a cursor, 10000 times
    SQL> begin
      2          for i in 1..10000 loop
      3                  CursorUse;
      4          end loop;
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    // no errors due to cursor leakage
    // session stats: no cursor leakage occurred as
    // PL/SQL's garbage collector cleaned (and closed)
    // cursor handles when these became out-of-scope
    SQL> select b.name, a.value from v$mystat a, v$statname b where a.statistic# = b.statistic# and b.name like '%open%cursor%';
    NAME                                  VALUE
    opened cursors cumulative            10,095
    opened cursors current                    2
    SQL> So the cursor leakage you are seeing is caused by something else... so what else is part of the code, or the session, that you have not yet mentioned?

  • ORA-01000 maximum open cursors exceeded with XA driver

    We are getting ORA-01000 maximum open cursors exceeded error from Oracle database
    agian and again.We are usimg XA driver.
    What is the weblogic's work around to handle this error?How we can handle this?We
    tried doing "grant select on DBA_PENDING_TRANSACTIONS to public ;" ,this also
    works for some time only.Again the same error starts coming.
    Help please.
    Thanx in advance.

    Thanks for your reply.
    I have increased my cursor size to 2000(default 300).We are using weblogic6.1
    and Oracle9i.Yes I was little aware about this bug so I tried doing "grant select
    on DBA_PENDING_TRANSACTIONS to public " from sys and no of open cursors reduced
    drastically but aftter some time increased again.We are using combination of thin,XA,non
    XA and oci drivers.
    We are using weblogic security framework also in our application and I think that
    consumes maximum no. of cursors.
    Kindly advice.
    Thanx a lot.
    Pinky
    Mitesh Patel <[email protected]> wrote:
    What is the size of cusror set in your oracle init.ora file?
    What version of oracle thin driver and weblogic are you using?
    Please read the following note:
    There is a bug with Oracle 817 driver's XAResource.recover implementation:
    it
    ignores the flag and always return all in-doubt Xids. After initially
    calling a resource's recover with TMSTARTRSCAN, TM subsequently calls
    the
    resource's recover with TMNOFLAGS until no more Xid is returned. Thus,
    Oracle driver's XAResource.recover is called infinitely until eventually
    it
    returns XAER_RMERR. Subsequent XAResource.start then returns ORA-01000
    exception (looks like all their XAResource methods internally uses prepared
    statements to execute some stored procedure.)
    Is this the case wth you?
    Mitesh
    Pinky Arora wrote:
    We are getting ORA-01000 maximum open cursors exceeded error from Oracledatabase
    agian and again.We are usimg XA driver.
    What is the weblogic's work around to handle this error?How we canhandle this?We
    tried doing "grant select on DBA_PENDING_TRANSACTIONS to public ;",this also
    works for some time only.Again the same error starts coming.
    Help please.
    Thanx in advance.

  • ORA-01000: maximum open cursors exceeded (please help / JDBC guru needed)

    ORA-01000: maximum open cursors exceeded
    I am getting this error when trying to execute 2,500 Sql DDL statements. I am executing the statement with:
    public boolean execute(String sql) ( like stmt.execute(sql); )
    After each execute() I close the statement ( like stmt.close() )
    I tried taking this a step further and decided to close and reopen the database connection after every 100 Sql statements processed and I still get this exception when continuing.
    ORA-01000: maximum open cursors exceeded
    Any help will be greatly appreciated. I need to figure how to close the cursors or how to finish processing all 2,500 statements. I do not have control over the init.ora file and can not increase the max cursors. I hope to figure out how to close the cursors so that no tweaking of the init.ora file is needed.
    ChrisTD

    Why dont you allocate dukes for this problem ???
    am getting this error when trying to execute 2,500 Sql DDL statements. I am executing the statement with:
    public boolean execute(String sql) ( like stmt.execute(sql); )
    After each execute() I close the statement ( like stmt.close() )
    What kind of DDL is that? are you using any cursor operations to fetch the data? What kind of query does this sql parameter contain?
    Look there is only 3 solutions for this kind of problem.
    1) shutdown the database and restart it.
    I dont think closing connection will shutdown the database as you
    told.
    2) shutdown the database access init.ora and increase the
    OPEN_CURSORS and then restart it.
    You told that you dont have access to init.ora.
    3) close every cursor that you open.(Probably you are not closing the cursor once you fetch the data).

  • ORA-01000 maximum open cursors exceeded - help!

    Hi, I need some help with resolving ORA-01000 maximum cursors exceeded issue.I know this issue has been discussed before. I know this is caused because of not closing the resultset and statement, connection objects at the right place.
    Can anyone guide me where I should close them?. should they be closed inside the while(rs.next()) loop? There are two prepared statments. I am sure closing in finally block is not enough.
    It would help if you show me by typing the code for closing rs , ps, rs2, ps2, and conn .. should conn be closed too? if yes where..
    Connection conn = null;
    PreparedStatement ps = null;
    PreparedStatement ps2 = null;
    ResultSet rs = null;
    ResultSet rs2 = null;
    ArrayList arrayList = new ArrayList();
    displayerDO pdo = null;
    DocTypeDO dtdo = null;
    StringBuffer sql = new StringBuffer();
    sql.append("SELECT displayer_id, name FROM tech_displayers ORDER BY name");
    StringBuffer sql2 = new StringBuffer();
    sql2.append(" SELECT D.doc_type_id, D.name" +
    " FROM tech_DOC_TYPES D, tech_DOC_TYPE_displayERS P" +
    " WHERE D.default_displayer_id = P.displayer_id" +
    " AND P.displayer_id = ?");
    if(VERBOSE)
    Debug.displayln("displayingControllerDAOORCL.getdisplayers(): sql = " + sql.toString());
    Debug.displayln("displayingControllerDAOORCL.getdisplayers(): sql2 = " + sql2.toString());
    try
    conn = DbUtil.getConnection("tech");
    ps = conn.prepareStatement(sql.toString());
    ps2 = conn.prepareStatement(sql2.toString());
    rs = ps.executeQuery();
    while(rs.next())
    pdo = new displayerDO();
    pdo.setdisplayerId(rs.getInt("displayer_id"));
    pdo.setName(rs.getString("name"));
    ps2.setInt(1, rs.getInt("displayer_id"));
    rs2 = ps2.executeQuery();
    while(rs2.next())
    dtdo = new DocTypeDO();
    dtdo.setDocTypeId(rs2.getInt("doc_type_id"));
    dtdo.setName(rs2.getString("name"));
    // get displayer name from FIRST result set
    dtdo.setdisplayer(rs.getString("name"));
    pdo.addDocType(dtdo);
    arrayList.add(pdo);
    catch(SQLException sqle)
    if(VERBOSE)
    Debug.displayln("displayingControllerDAOORCL.getDocdisplayers(): exception e=" + sqle);
    throw sqle;
    finally
    DbUtil.close(rs2);
    DbUtil.close(ps2);
    DbUtil.close(ps, rs, conn);
    Thanks,
    scott

    Scott,
    From the code it looks like for every row of "ps" you are executing "ps2".
    You should close ps2 as soon as it is done.
    ie.,
    <pre>
    while(rs.next())
    pdo = ...
    rs2 = ps2.executeQuery()
    while (rs2.next())
    }// end of while(rs2.next())
    rs2.close(); // NEW LINE: Close the resultset here.
    }// end of while(rs.next())
    HTH
    Ashok

  • How to resolve the issue of ORA-01000: maximum open cursors exceeded

    Hi all,
    I'm new to Oracle, currently I write a simple java class to retrieve records form Oracle DB, but following error occurs:
    java.sql.SQLException: ORA-01000: maximum open cursors exceeded
    String sql = "select * from......";
    prepStmt = conn.prepareStatement(sql);
    prepStmt.setString(1, this.getId());
    rlt = prepStmt.executeQuery();
    while (rlt.next()) {
    try {
         rlt.getString("severity");
    rlt.getTimestamp("time_stamp");
    violationList.add(viol);
    } catch (Exception e) {                         
    When there are only few records in the table, it is ok, but if the result is large, occur the exception.
    Why and how to resolve?
    Thanks.
    Jane

    It is better to close statement using try...catch...finally , e.g.
    PreparedStatement objStmt = null;
    try
         objStmt = conn.prepareStatement(...);
         // ... do anything
    catch (Exception e)
         // ... exception handling
    finally
         // another try...catch block to handle exception during statement close
         try {   objStmt.close();   }     catch (Exception e) {   }
         objStmt = null;
    This would guarantee that statment object is being closed even though exception is thrown. (Don't wait for connection release by garbage collector)

  • Urgent!!! ORA-01000: maximum open cursors exceeded

    hello guys, I have done a search in this forum and read plenty of threads, but I didn't find any official answer to this question. In my code, I have closed all the statements and resultsets after using them, but I still got the MAXIMUM OPEN CURSOR exceed exception.
    I am not sure whether I close the stmt and rs in the right way. Which one should I close first, the statement or the resultset? Does the order matters??? Thanks a million you can have a good way to solve this problem!!!
    Statement st= null;
    ResultSet rs = null;
    try{
    .......// some code
    }catch(SQLException sqle){
    finally{
    if(st!=null)
    st.close();
    if(rs!=null)
    rs.close();

    The connection I am using is from a pool. I can't close the connection because I need to return it to the pool...
    BTW, I just solved the ORA-01100 problem. Here is what I did, I hope it may be helpful.
    The original code I have looks like this. That's the code that generates the ORA-01100 exception.
    Connection conn = null;
    PreparedStatement pstmt= null;
    ResultSet rs = null;
    try{ 
          conn = Pool.getConection();  // get connection from pool
          String sql = "someSQL";
          pstmt = conn.prepareStatement(sql);
          rs = pstmt.executeQuery();
          while(rs.next()) {
              // do something with the resultset
          // here, I reuse the pstmt and rs. 
          // I think that is what cause the ORA-01000 problem
          // because I don't think there is anything wrong
          // with the finally block
          sql = "another query";
          pstmt = conn.prepareStatement(sql);
          rs = pstmt.executeQuery();
          while(rs.next()) {
              // do something with the resultset
    }catch(SQLException sqle) {
            // ignore.......
    } finally {
       try
          if(rs!=null) rs.close();
          if(pstmt!=null) pstmt.close();
          if(conn != null) Pool.returnConnection(conn); // return connection to pool
       } catch(Exception fe) {
    }Here is the fixed version of the code that eliminates the ORA-01000 error in my case. If in your code, you re-use your statements, preparedstatments or results, You can try it too.
    Connection conn = null;
    PreparedStatement pstmt= null;
    ResultSet rs = null;
    try{ 
          conn = Pool.getConection();
          String sql = "someSQL";
          pstmt = conn.prepareStatement(sql);
          rs = pstmt.executeQuery();
          while(rs.next()) {
              // do something with the resultset
          // In the fixed version, I only added the block of
          // code below and it solves the problem. 
           // Before I re-use the preparedstatments,
          // statement, and result  for a new query,
          // I closed them and set them to null. 
         try {
            if(rs != null) rs.close();
            if(pstmt != null) pstmt.close();
            rs = null;
            pstmt = null;
         } catch(Exception ie) {
           // ignore
          sql = "another query";
          pstmt = conn.prepareStatement(sql);
          rs = pstmt.executeQuery();
          while(rs.next()) {
              // do something with the resultset
    }catch(SQLException sqle) {
            // ignore.......
    } finally {
       try
          if(rs!=null) rs.close();
          if(pstmt!=null) pstmt.close();
          if(conn != null) Pool.returnConnection(conn); // return connection to pool
       } catch(Exception fe) {

  • ORA-01000 during inserting xml files

    Hello,
    I'm using the following jdbc-code to insert xml files into oracle 10gRelease2:
    PreparedStatement stmt = null;
    Connection conn = getConnection();
    try
    stmt = conn.prepareStatement("insert into security values (?)");
    } catch (Exception e) {
    System.err.println(e);
    BufferedInputStream bufferedInputStream;
    for (int i = 1; i < 500; i++)
    String docName = "../../../data/output/security/security" + i+ ".xml";
    try
    FileInputStream fileInputStream = new FileInputStream(docName);
    bufferedInputStream = new BufferedInputStream(fileInputStream, 5000);
    XMLType doc = null;
    doc = XMLType.createXML(conn, bufferedInputStream);
    stmt.setObject(1, doc);
    stmt.executeUpdate();
    doc.close();
    fileInputStream.close();
    } catch (Exception e) {
    System.out.println(i);
    System.err.println(e);
    conn.commit();
    The code is working fine when I insert less than 340 files. But when I try to insert more than 340 files I'm getting the error:
    java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
    ORA-01000: maximum open cursors exceeded
    Where do I open so many cursors? During creating the XMLType?
    Thx,
    Fabian

    I can reproduce this. Looks like a problem with the XMLType.createXML() method. Will confirm and file a bug if necessary. In the mean time the following works and has the same effect
    package com.oracle.st.xmldb.pm.examples;
    import com.oracle.st.xmldb.pm.common.baseApp.BaseApplication;
    import java.io.ByteArrayInputStream;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.io.Reader;
    import java.io.Writer;
    import java.sql.SQLException;
    import oracle.jdbc.OracleCallableStatement;
    import oracle.jdbc.OraclePreparedStatement;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.CLOB;
    import oracle.xdb.XMLType;
    public class BulkInsertXMLType extends BaseApplication
       public static String TABLE_NAME  = "Table";
       public static String SOURCE_FILE = "File";
       public static String ITERATIONS  = "Iterations";
       public void doSomething(String[] Args) throws Exception
          OracleCallableStatement  statement = null;
          String statementText;
          XMLType xml;
          CLOB    clob = CLOB.createTemporary( getConnection(), true, CLOB.DURATION_SESSION);
          // statementText = "insert into " + this.getSetting(this.TABLE_NAME) + " values(:1)";
          statementText = "insert into " + this.getSetting(this.TABLE_NAME) + " values(xmltype(:1))";
          System.out.println("GetXMLType.doSomething : Driver Type = " + this.getDriver() + ". Statement = " + statementText);
          statement = (OracleCallableStatement) getConnection().prepareCall(statementText);
          for (int i=0; i < Integer.parseInt(getSetting(this.ITERATIONS)); i++)
            try {
              InputStream is = new FileInputStream(getSetting(this.SOURCE_FILE));
              // xml = XMLType.createXML(this.getConnection(),is);            
              // statement.setObject(1,xml);
              InputStreamReader reader = new InputStreamReader( is );
              Writer writer = clob.setCharacterStream(0);
              char [] buffer = new char [ clob.getChunkSize() ];
              for( int charsRead = reader.read( buffer );
              charsRead > - 1;
              charsRead = reader.read( buffer ) )
                 writer.write( buffer, 0, charsRead );
              writer.close();
              reader.close();
              statement.setCLOB(1,clob);
              boolean result = statement.execute();
              is.close();
              clob.truncate(0);
            catch (SQLException sqle) {
                System.out.println("SQL Exception caught after " + i + "Iterations");
                System.out.println(sqle);
                throw sqle;
          CLOB.freeTemporary(clob);
          statement.close();
          getConnection().commit();
          getConnection().close();
      public static void main (String[] args)
        try
          BulkInsertXMLType example = new BulkInsertXMLType();
          example.initializeConnection();
          example.doSomething(args);
        catch (Exception e)
          e.printStackTrace();
    }

  • Ora-00604 error and ora 01000 error while report generation.

    hi all,
    I am trying to generate the multiple reports of same template through a program.
    While this job is running, i get the following error at the BIP console and the reports don't get generated.
    [101711_044115578][][EXCEPTION] java.sql.SQLException: ORA-00604: error occurred
    at recursive SQL level 1
    ORA-01000: maximum open cursors exceeded
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01000: maximum open cursors exceeded
    ORA-01000: maximum open cursors exceeded
    Kindly help.
    Thanks.

    Lots of resources with a simple search to see what this is about, for example:
    http://www.orafaq.com/wiki/ORA-01000
    ORA-01000:     maximum open cursors exceeded
    Cause:     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.
    open_cursors parameter
    http://download.oracle.com/docs/cd/E11882_01/server.112/e25513/initparams160.htm#REFRN10137
    Oracle support note:
    OERR: ORA-1000 maximum open cursors exceeded (Doc ID 18591.1)

  • Login issues with xelsysadm along with ORA-01000 (cursor exceeded) error

    Hi,
    I am facing an strange problem.
    Because of below error i am facing an intermitant issues for login to OIM web console and Design console with user xelsysadm. Some time the login in successfull else the error is generated.
    For the error -- ORA-01000: maximum open cursors exceeded
    We had talked to DB team an increased the cursor limit from 300 to 800. But still the same issue.
    So, let me know whether this can be resolved if i take bounce of the web logic server or there is some other solution?
    Thanks in advance and some respond ASAP as this is production server and this issue need to be resolved soon.
    Getting below errors in the system:
    ERROR,20 Apr 2011 08:35:19,613,[XELLERATE.WEBAPP],Class/Method: tcLogonAction/execute encounter some problems: User account is invalid. Username: xelsysadm
    ERROR,20 Apr 2011 08:40:00,056,[XELLERATE.ACCOUNTMANAGEMENT],Class/Method: Authenticate/connect encounter some problems: ORA-01000: maximum open cursors exceeded
    java.sql.SQLException: ORA-01000: maximum open cursors exceeded
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1030)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:785)
    at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:860)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3381)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3425)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1490)
    at com.thortech.xl.security.Authenticate.getPropertyValue(Authenticate.java:459)
    at com.thortech.xl.security.Authenticate.connect(Authenticate.java:117)
    at com.thortech.xl.security.Authenticate.connect(Authenticate.java:71)
    at com.thortech.xl.security.wl.XellerateLoginModuleImpl.login(XellerateLoginModuleImpl.java:159)
    at com.bea.common.security.internal.service.LoginModuleWrapper$1.run(LoginModuleWrapper.java:110)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.bea.common.security.internal.service.LoginModuleWrapper.login(LoginModuleWrapper.java:106)
    at sun.reflect.GeneratedMethodAccessor7737.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
    at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
    at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
    at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
    at com.bea.common.security.internal.service.JAASLoginServiceImpl.login(JAASLoginServiceImpl.java:113)
    at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.common.security.internal.utils.Delegator$ProxyInvocationHandler.invoke(Delegator.java:57)
    at $Proxy16.login(Unknown Source)
    at weblogic.security.service.internal.WLSJAASLoginServiceImpl$ServiceImpl.login(Unknown Source)
    at com.bea.common.security.internal.service.JAASAuthenticationServiceImpl.authenticate(JAASAuthenticationServiceImpl.java:82)
    at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.common.security.internal.utils.Delegator$ProxyInvocationHandler.invoke(Delegator.java:57)
    at $Proxy34.authenticate(Unknown Source)
    at weblogic.security.service.WLSJAASAuthenticationServiceWrapper.authenticate(Unknown Source)
    at weblogic.security.service.PrincipalAuthenticator.authenticate(Unknown Source)
    at weblogic.security.acl.internal.Security.authenticateLocally(Security.java:127)
    at weblogic.security.acl.internal.Security.authenticate(Security.java:165)
    at weblogic.security.acl.internal.Security.authenticate(Security.java:146)
    at weblogic.security.auth.Authenticate.authenticate(Authenticate.java:112)
    at weblogic.security.auth.login.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:184)
    at sun.reflect.GeneratedMethodAccessor7746.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
    at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
    at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
    at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
    at Thor.API.Security.LoginHandler.weblogicLoginHandler.login(Unknown Source)
    at Thor.API.tcUtilityFactory.<init>(Unknown Source)
    at com.thortech.xl.scheduler.core.quartz.QuartzWrapper.execute(Unknown Source)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:477)
    ERROR,20 Apr 2011 08:40:00,058,[XELLERATE.ACCOUNTMANAGEMENT],Class/Method: XellerateLoginModuleImpl/login encounter some problems:
    com.thortech.xl.security.tcLoginException:
    at com.thortech.xl.security.tcLoginExceptionUtil.createException(tcLoginExceptionUtil.java:96)
    at com.thortech.xl.security.tcLoginExceptionUtil.createException(tcLoginExceptionUtil.java:67)
    at com.thortech.xl.security.Authenticate.connect(Authenticate.java:269)
    at com.thortech.xl.security.Authenticate.connect(Authenticate.java:71)
    at com.thortech.xl.security.wl.XellerateLoginModuleImpl.login(XellerateLoginModuleImpl.java:159)
    at com.bea.common.security.internal.service.LoginModuleWrapper$1.run(LoginModuleWrapper.java:110)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.bea.common.security.internal.service.LoginModuleWrapper.login(LoginModuleWrapper.java:106)
    at sun.reflect.GeneratedMethodAccessor7737.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
    at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
    at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
    at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
    at com.bea.common.security.internal.service.JAASLoginServiceImpl.login(JAASLoginServiceImpl.java:113)
    at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.common.security.internal.utils.Delegator$ProxyInvocationHandler.invoke(Delegator.java:57)
    at $Proxy16.login(Unknown Source)
    at weblogic.security.service.internal.WLSJAASLoginServiceImpl$ServiceImpl.login(Unknown Source)
    at com.bea.common.security.internal.service.JAASAuthenticationServiceImpl.authenticate(JAASAuthenticationServiceImpl.java:82)
    at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.common.security.internal.utils.Delegator$ProxyInvocationHandler.invoke(Delegator.java:57)
    at $Proxy34.authenticate(Unknown Source)
    at weblogic.security.service.WLSJAASAuthenticationServiceWrapper.authenticate(Unknown Source)
    at weblogic.security.service.PrincipalAuthenticator.authenticate(Unknown Source)
    at weblogic.security.acl.internal.Security.authenticateLocally(Security.java:127)
    at weblogic.security.acl.internal.Security.authenticate(Security.java:165)
    at weblogic.security.acl.internal.Security.authenticate(Security.java:146)
    at weblogic.security.auth.Authenticate.authenticate(Authenticate.java:112)
    at weblogic.security.auth.login.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:184)
    at sun.reflect.GeneratedMethodAccessor7746.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
    at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
    at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
    at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
    at Thor.API.Security.LoginHandler.weblogicLoginHandler.login(Unknown Source)
    at Thor.API.tcUtilityFactory.<init>(Unknown Source)
    at com.thortech.xl.scheduler.core.quartz.QuartzWrapper.execute(Unknown Source)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:477)
    ERROR,20 Apr 2011 08:40:00,060,[XELLERATE.ACCOUNTMANAGEMENT],Class/Method: tcUtilityFactory/tcUtilityFactory(Hashtable env, tcSignatureMessage poUserIDMessage) encounter some problems: javax.security.auth.login.LoginException: java.lang.SecurityException: [Security:090304]Authentication Failed: User xelsysadm javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User xelsysadm denied
    javax.security.auth.login.LoginException: javax.security.auth.login.LoginException: java.lang.SecurityException: [Security:090304]Authentication Failed: User xelsysadm javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User xelsysadm denied
    at weblogic.security.auth.login.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:199)
    at sun.reflect.GeneratedMethodAccessor7746.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
    at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
    at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
    at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
    at Thor.API.Security.LoginHandler.weblogicLoginHandler.login(Unknown Source)
    at Thor.API.tcUtilityFactory.<init>(Unknown Source)
    at com.thortech.xl.scheduler.core.quartz.QuartzWrapper.execute(Unknown Source)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:477)
    ERROR,20 Apr 2011 08:40:00,060,[XELLERATE.SERVER],Class/Method: QuartzWrapper/execute encounter some problems: javax.security.auth.login.LoginException: javax.security.auth.login.LoginException: java.lang.SecurityException: [Security:090304]Authentication Failed: User xelsysadm javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User xelsysadm denied
    Thor.API.Exceptions.tcAPIException: javax.security.auth.login.LoginException: javax.security.auth.login.LoginException: java.lang.SecurityException: [Security:090304]Authentication Failed: User xelsysadm javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User xelsysadm denied
    at Thor.API.tcUtilityFactory.<init>(Unknown Source)
    at com.thortech.xl.scheduler.core.quartz.QuartzWrapper.execute(Unknown Source)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:477)
    [CMGR WARNING] Removing connection pool siebel.tcpip.None.none://172.30.16.51:2321/UW_PROD/eCommunicationsObjMgrClone_enu/!b.3c26
    <com.siebel.common.common.CSSException>
    <Error><ErrorCode>8716601</ErrorCode> <ErrMsg>Socket had incorrect word size: 0.(SBL-JCA-00313)</ErrMsg></Error>
    </com.siebel.common.common.CSSException>
    at com.siebel.om.conmgr.Connection.readPacket(Connection.java:550)
    at com.siebel.om.conmgr.Connection.run(Connection.java:286)
    at java.lang.Thread.run(Thread.java:619)
    [CMGR FATAL] Error: <com.siebel.common.common.CSSException>
    <Error><ErrorCode>8716601</ErrorCode> <ErrMsg>Socket had incorrect word size: 0.(SBL-JCA-00313)</ErrMsg></Error>
    </com.siebel.common.common.CSSException> connection:d0214e
    *************************************************************************************************************

    Thanks for giving me an solution..
    The cursor limit was incresed from 300 to 800 then for some hours the things went with no issues, the login was successfull and no errors in the logs. But again the same issue had arrisen.
    For now i have taken bounce of the welogic servers because of the bounce i hope the existing/stuckup connections have been released and now the application is working fine and with no issues.
    But is taking the bounce of the application server is the only solution for getting the things back to normal
    Or
    whether we need to take some other steps even after increasing the cursor limit the things don;t work.
    Thanks,

  • Implicit PL/SQL cursors remain open, causing ORA-01000 (Client 9.2.0.1)

    Hello,
    since migrating our system from Oracle Client 9.0.X to 9.2.0.1 (Windows XP), i am encountering troubles when calling a stored procedure from a Cobol-Program:
    after a while i run into a 'Maximum open cursors exceeded'-message (ORA-01000)
    The stored procedure returns a cursor (ref_cursor)
    When Executing the stored procedure, there are actually 2 cursors involved, in fact the stored PL/SQL procedure implicitely opens a child-cursor when doing a select within the PL/SQL.
    After fetching the result and closing the cursor in my cobol-program, it correctly closes the cursor associated with the stored-procedure, but it does not close the cursor that was implicitely opened by oracle.
    After a while i am running into a Maximum open cursors message, because those cursors have not properly been closed.
    Here's a simple PL/SQL package that illustrates the problem:
    create or replace package scott.SCOTTS_PACKAGE is
    type ref_cursor IS REF CURSOR;
    function GET_EMP(EMP_IN CHAR) return ref_cursor;
    end SCOTTS_PACKAGE;
    create or replace package body scott.SCOTTS_PACKAGE is
    -- Function and procedure implementations
    function GET_EMP(EMP_IN CHAR) return ref_cursor is
    MyCurs ref_cursor;
    begin
    OPEN MyCurs FOR
    SELECT EMPNO ,
    ENAME ,
    JOB
    FROM SCOTT.EMP
    WHERE ENAME = EMP_IN;
    return(MyCurs);
    end;
    end SCOTTS_PACKAGE;
    Here are some exerpts from my cobol program:
    (The program iterates 100x through the section that executes the PL/SQL. After each iteration an additional open cursor remains in the database)
    003800 EXEC SQL BEGIN DECLARE SECTION END-EXEC.
    003900*
    004000 01 SQL-USERNAME PIC X(16) VARYING.
    004100 01 SQL-PASSWD PIC X(16) VARYING.
    004200 01 SQL-DBNAME PIC X(64) VARYING.
    004300 01 ORACLE.
    004700 02 ORA-CUR-EMP SQL-CURSOR.
    01 EMPREC.
    02 EMPREC-EMPNO PIC X(4).
    02 EMPREC-ENAME PIC X(10).
    02 EMPREC-JOB PIC X(9).
    005400 EXEC SQL END DECLARE SECTION END-EXEC.
    018400 PROCEDURE DIVISION.
    CONTINUE.
    018700 EXEC SQL
    018800 WHENEVER SQLERROR DO PERFORM SQL-ERROR
    018900 END-EXEC.
    019000*
    CONTINUE.
    019100 EXEC SQL
    019200 WHENEVER NOT FOUND DO PERFORM SQL-NOT-FOUND
    019300 END-EXEC.
    022400 EXEC SQL
    022500 ALLOCATE :ORA-CUR-EMP
    022600 END-EXEC
    PERFORM VARYING I FROM 1 BY 1 UNTIL I > 100
    ACCEPT DUMMY FROM TER
    IF DUMMY = "E"
    MOVE 100 TO I
    END-IF
    PERFORM GET-EMP
    ADD 1 TO I
    END-PERFORM
    119300 GET-EMP SECTION.
    119400************************
    119500 GAM0.
    MOVE SPACES TO EMPREC-EMPNO EMPREC-JOB
    MOVE "SMITH" TO EMPREC-ENAME
    120200 EXEC SQL AT SSSI EXECUTE
    120300 BEGIN
    120400 :ORA-CUR-EMP:=
    120500 SCOTT.SCOTTS_PACKAGE.GET_EMP(:EMPREC-ENAME );
    120900
    END;
    121000 END-EXEC
    121200 IF DB-ERR-CODE NOT = HIGH-VALUE
    121300 DISPLAY "CCSIFSO:GET-AUTRE-MATR:APPEL PERS... OK"
    121400 EXEC SQL
    121500 FETCH :ORA-CUR-EMP
    121600 INTO
    121700 :EMPREC-EMPNO,
    121800 :EMPREC-ENAME,
    121900 :EMPREC-JOB
    122400 END-EXEC
    122500 END-IF
    122600*
    122700 IF DB-ERR-CODE NOT = HIGH-VALUE
    122800 DISPLAY "CCSIFSO:GET-AUTRE-MATR:APPEL FETCH.. OK"
    123000 ELSE
    123100 MOVE LOW-VALUE TO DB-ERR-CODE
    123200 END-IF
    123300 EXEC SQL
    123400 CLOSE :ORA-CUR-EMP
    123500 END-EXEC
    123600 GA-EX.
    123700 EXIT.
    124000 SQL-NOT-FOUND SECTION.
    124100*----------------------
    124200 NF0.
    124300 DISPLAY "CCSIFSO:SQL-NOT-FOUND SECTION."
    124400 MOVE HIGH-VALUE TO DB-ERR-CODE.
    124500 NF-EX.
    124600 EXIT.
    124700*
    124800 SQL-ERROR SECTION.
    124900*-----------------
    125000 ER0.
    125200 EXEC SQL
    125300 WHENEVER SQLERROR CONTINUE
    125400 END-EXEC
    125700 MOVE HIGH-VALUE TO DB-ERR-CODE
    125800*
    126100 DISPLAY "ORACLE ERROR DETECTED: " SQLCODE UPON TER
    126200 DISPLAY SQLERRMC UPON TER
    126300*
    126400 EXEC SQL AT SSSI
    126500 ROLLBACK WORK
    126600 RELEASE
    126700 END-EXEC
    126800 DISPLAY "----------------------------" UPON TER
    126900 DISPLAY " ! ROLLBACK ET DISCONNECT ! " UPON TER
    127000 DISPLAY "----------------------------" UPON TER
    127200 CALL "PPTERMJ".
    127400 ER-EX.
    127500 EXIT.
    Finally here's an exerpt from V$OPEN_CURSOR, after a few iterations:
    1 begin :b1 := SCOTT . SCOTTS_PACKAGE . GET_EMP (:b2 ) ; END ;
    2 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    3 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    4 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    5 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    6 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    7 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    8 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    9 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    10 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    11 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    As you see, there is only 1 cursor starting with 'begin ... '
    but there are 10 implicit cursors 'SELECT EMPNO, ... ' that have not been properly closed, nor reused by ORACLE.
    In our old configuration (ORACLE CLient 9.0.X), you would only see:
    1 begin :b1 := SCOTT . SCOTTS_PACKAGE . GET_EMP (:b2 ) ; END ;
    2 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    meaning all the other cursors have properly been closed.
    As a conclusion: the program correctly closes the implicit cursors when using a 9.0 Client, wheras the implicit cursors remain open on Client 9.2.0.1 (Windows XP)
    The underlying database can be either 8.i or 9, the problem remains the same.
    Finally here's a small Delphi code, using ODAC-components, that somewhat illustrates the same problem:
    procedure TForm1.ExecProcClick(Sender: TObject);
    var I: INTEGER ;
    begin
    FOR I := 1 TO 5 DO
    BEGIN
    SP1.StoredProcName:='SCOTT.SCOTTS_PACKAGE.GET_EMP';
    SP1.Prepare;
    SP1.ParamByName('EMP_IN').AsString := 'SMITH';
    SP1.ExecProc;
    SP1.Next;
    SP1.Close;
    SP1.UnPrepare;
    END;
    end;
    After each call to 'PREPARE', an additional implicit cursor remains open on the database. (using Oracle Client 9.2.0.1)
    On our old system (Oracle Client 9.0 or 8.X), the same program would not generate accumulating open cursors on the database
    Any suggestions would be welcome,
    Claude

    Cobol.. been many years since I last even saw some Cobol source code. Invokes all kinds of memories. :-)
    Since you found the patch, the advice is superfluous, but works. Close the cursor at the PL/SQL side, e.g.
    create or replace procedure CloseRefCursor( cRefCursor TYPELIB.TRefCursor ) is
    begin
      close cRefCursor;
    exception when OTHERS then
      -- if the cursor is already gone, not a problem
      NULL;
    end;In Delphi for example, one can subclass the class used for ref cursor calls and add a call to the above PL/SQL proc in the destructor. Or add create a standard Cobol close ref cursor section that does similar.

  • Maximum open cursors in SQLJ, ORA-01000

    Hello,
    Can someone please help me with the following: I have a java application that does 7000 insert statements, but I get ORA-01000 after only 200-300 inserts. The error message is:
    Exception: java.sql.SQLException: ORA-01000: maximum open cursors exceeded
    A simplified version of my insert in sqlj:
    try {
         #sql [_ctx] {
              insert into TABLE_X
              ( name, addr ) values
              (:m_name,m_addr)
    } catch(SQLException e){
              m_mgr.GetErrorLog().logError("Critical",
         "Failed to insert user into TABLE_X","","Program aborting","?",e );
              m_mgr.SystemErrorExit();
    1. The only answers I can find in the forums is either to increase max open cursors in inti.ora, or to close your statements correctly. I'v tried increasing max open cursors but this does not help..(its not a very god approach anyway), and I can't see why I should close my statements from SQLJ: This error did not occur in the same application on a different platform 10 months ago.
    2. Could it have something to do with the thin driver version I'm using. Either in JDev or in the database. I use JDev 903 (on win 2000) and a 8.1.7.4 database (on solaris).
    3. I tried using oci8 connectoin, but could not get it working. Using oci8 i got the error
    java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
    Feedback appreciated.
    /Anders

    For oci to work you should have Oracle or SQL client installed on your machine.
    You should also have ORACLE_HOME\bin in you path.
    ocijdbc9.dll is available in the above directory.
    Chandar

Maybe you are looking for

  • Mail goes offline since 10.5.4 update

    In the week or so since I did the 10.5.4 upgrade, I've noticed that over the course of the work day (machine is not asleep, and network is supposedly always connected) when I look at my Mail Inbox I periodically see the little warning triangle - the

  • How to put free games an music on my iphone

    new at this need help with free apps always saying put email an password in

  • How do I change the font size on Adobe Reader 8.1.2

    I recently purchased an HP  laptop running Vista. It came with Adobe Reader 8.1.2.  I can't change the font size in a form that I am filling out.  I can cut& paste a different font size into the form but not change the font size.  Someone said that i

  • How to get (old)previous date and create a loop?

    Hi!!! I am using java.util.date object. I need to get the 2 months back date,i.e. 60 days back date and to create a loop from that date till today and add it to combobox. Suppose today's date=3-12-2001 x=date-60=3-10-2001 and wants to create a loop f

  • Editing a Pre-Made template

    I bought a premade flash template, however as of now it is created in non-flash format. I would love to have my top piece as the flash that it was meant to be. My site is currently http://www.georgiavideoproductions.com and the way that it should loo