Error : Maximum Open Cursors Exceded

Hi!
The error appear in that check out or check an objet using OSCM. At first I cna do it but when i trying to check in or out files the messages appear. I don´t understand why and for waht action it appear.
Any suggestion??
Thanks!
Matias

Did you increase the max open cursors to 3000 as recommended in the OracleSCM install guide?
Rob

Similar Messages

  • The error:maximum open cursors exceeded,how to resolve it??

    the parameter is as following in oracle: open_cursors=300
    i write the following two methos get data from oracle db,after invote the methods many times,the program thrwos the exception named "maximum open cursors exceeded";why?how to resolve it?
    in my program ,i have closed the statment and resultset!
    the following is the code,and method a call mehtod b:
    mehtod a:
    //modeify the product and call mothod b
    public boolean modifyDVBProd(Integer prodIDInt,ProdRequestEn prod)
    boolean successB=false;
    Connection conn=...;
    if(conn!=null)
    try
    conn.setAutoCommit(false);
    //the following call method b
    successB=ProdOperateBL.getInstance().modifyDVBProd(conn,prodIDInt,prod);
    if(successB)
    conn.commit();
    else
    conn.rollback();
    catch(Exception e)
    successB=false;
    try
    conn.rollback();
    catch(Exception ex)
    ex.printStackTrace();
    e.printStackTrace();
    finally
    try
    conn.setAutoCommit(true);
    catch (SQLException ex)
    ex.printStackTrace();
    else
    successB=false;
    return successB;
    method b;��
    //modify products
    public boolean modifyDVBProd(Connection conn,Integer prodIDInt,ProdRequestEn prod)
    boolean successB=false;
    String sqlPriceStr="UPDATE pricemodelen pm SET pm.rentpricf=? WHERE pm.priceidl=(SELECT p.priceidl FROM producten p WHERE p.productidl=?)";
    String sqlProdStr="UPDATE producten p set pronamestr=?,prod_type=?,unidstr=?,catype_name=?,casid=?,entitle_code=?,validfrdt=?,validtodt=?,descstr=? WHERE P.productidl=?";
    String sqlProd_channelDelStr="DELETE FROM proden_channelen c WHERE c.productidl=?";
    String sqlProd_channelInsertStr="INSERT INTO proden_channelen(productidl,channel_id) VALUES(?,?)";
    PreparedStatement pstmt1=null;
    PreparedStatement pstmt2=null;
    PreparedStatement pstmt3=null;
    PreparedStatement pstmt4=null;
    int paramIndexInt=1;
    try
    //price
    pstmt1=conn.prepareStatement(sqlPriceStr);
    pstmt1.setDouble(paramIndexInt++,prod.getProdPriceD());
    pstmt1.setDouble(paramIndexInt++,prodIDInt.intValue());
    int priceResult=pstmt1.executeUpdate();
    //product
    pstmt2=conn.prepareStatement(sqlProdStr);
    paramIndexInt=1;
    pstmt2.setString(paramIndexInt++,prod.getProdNameStr()); //product name
    pstmt2.setInt(paramIndexInt++,prod.getProdTpInt());//product type
    pstmt2.setString(paramIndexInt++,prod.getPriceUnitStr());//unit
    pstmt2.setString(paramIndexInt++,prod.getCaTpStr());//type
    pstmt2.setInt(paramIndexInt++,prod.getCasidInt());//casid
    pstmt2.setString(paramIndexInt++,prod.getCaEntitleCodeStr());//caentitlecode
    pstmt2.setDate(paramIndexInt++,prod.getValidBeginDate());//time
    pstmt2.setDate(paramIndexInt++,prod.getValidEndDate());//time
    pstmt2.setString(paramIndexInt++,prod.getProMemoStr());//memo
    pstmt2.setInt(paramIndexInt++,prodIDInt.intValue());//id
    int prodResult=pstmt2.executeUpdate();//
    pstmt3=conn.prepareStatement(sqlProd_channelDelStr);
    pstmt3.setInt(1,prodIDInt.intValue());
    pstmt3.executeUpdate();
    int channelResult=0;
    for(int i=0;i<prod.getChannelIDsInt().length;i++)
    pstmt4=conn.prepareStatement(sqlProd_channelInsertStr);
    pstmt4.setInt(1,prodIDInt.intValue());
    pstmt4.setInt(2,prod.getChannelIDsInt());
    pstmt4.addBatch();
    pstmt4.executeBatch();
    //((OraclePreparedStatement)pstmt).sendBatch(); // JDBC sends the queued request
    if((prodResult>0)&&(priceResult>0))
    successB=true;
    catch(Exception ex)
    successB=false;
    ex.printStackTrace();
    finally
    //closing the preparedstatement
    try
    if(pstmt1!=null)
    pstmt1.close();
    if(pstmt2!=null)
    pstmt2.close();
    if(pstmt3!=null)
    pstmt3.close();
    if(pstmt4!=null)
    pstmt4.close();
    catch (SQLException ex)
    ex.printStackTrace();
    return successB;

    Check this loop.
    or(int i=0;i<prod.getChannelIDsInt().length;i++)
    pstmt4=conn.prepareStatement(sqlProd_channelInsertStr);
    pstmt4.setInt(1,prodIDInt.intValue());
    pstmt4.setInt(2,prod.getChannelIDsInt());
    pstmt4.addBatch();
    Here every time the loop executes, a new statement object is created and assigned to the same statement object reference pstmt4. So finally when u r closing the stmt objects, only one stmt object gets closed out of prod.getChannelIDsInt().length that gets created with in the loop.

  • Maximum open Cursors Excedded error - for every transaction

    Hi All,
    I am getting the maximum opn cursors exceeded error suddenly for every single db transaction i am trying to make in my application. this did not happen previously during my developemnt and testing phase.
    I have a question here that i tried to google but failed to get satisfactory answer.:-
    When we use a cursor in the stored procedure to fetch data, how to make oracle automatically close the cursors once the stored proc finishes executin. Or is there something i have to follow other with my current open cursors limit to ensure this problem does not happen?
    Thanks,
    Chaitanya

    Hi Justin,
    My oracle stored procs are called by java framework. In each place i was closing the connection object but there were a few places where i was not closing the resultset object which directly pointed to my oracle cursor.
    I have closed the objects in such places and tried again but still i am getting the same error. Mit it be an instance where the oracle db is not allowing me to connect to it at all. Something like restarting it would help? Restarting the server where the oracle software is hosted.
    Please excuse my blatant ignorance in this issue.
    Thanks,
    Chaitanya

  • Maximum Open Cursors with the CachedRowSet

    Hi all,
    I have a simple task that is cause significant headaches. I'm using the CachedRowSet to process records from an Oracle 8.1.6 database. The code simply populates the row set with records, makes changes to 2 or 3 fields in each record, then calls the acceptChanges().
    When I process about 200 records, everything works fine. If I try to process 300 records, I get the error
    "ORA-01000: maximum open cursors exceded".
    Right before the acceptChanges is called, there is only 1 cursor opened ( I'm checking this via the V$OPEN_CURSOR table). After the acceptChanges is called, it throws the error. Inside my catch block, I put a loop in to print the open cursors. All but two of them is from my app and showing the exact same SQL, update table set name ....
    I have tried populating it directly and through a ResultSet, neither work. When I do a similar process using a ResultSet by itself, it is fine.
    If anyone could please suggest what I might be overlooking I would appreciate it. Also, I would also like to know if there is someway to examine the specific SQL that is being sent to the database if possible.

    we've had similar problems with Oracle creating and not destroying its own cursors("under the covers"). There is relevant info at the following link:
    http://forums.java.sun.com/thread.jsp?forum=48&thread=135291
    quick checklist:
    1. close all statements/preparedstatements/resultsets explicitly and immediately after you are finished with them
    2. increase your number of open_cursors in init.ora file
    -->we had to increase ours to over 700 at one point.
    3. commit/rollback explicitly when finished transactions.
    hope this helps
    Jamie

  • In java/jsp got Error,ORA-01000: maximum open cursors exceeded,

    Dear ALL,
    We are facing a problem of in java/jsp. ORA-01000: maximum open cursors exceeded,We are using referance Cursor for returing the Record in java file.
    The Code is given below.
    import java.sql.*;
    import javax.sql.*;
    import com.india.trade.dbConnection.*;
    import oracle.jdbc.driver.*;
    import java.util.Vector ;
    public class IntRmsActivity
         private static JDBCConnection instance = null;
    private static Connection con = null;
         private static CallableStatement stmt_admin_getadmins = null;
         private static String str_admin_getadmins = "{ call Admin_conf.RMS_ADMIN_GETALLADMINS(?,?) }";
         static
              try
                   instance = new JDBCConnection();
                   con = instance.getConnection();
                   stmt_admin_getadmins = con.prepareCall(str_admin_getadmins);
    }catch(Exception se){se.printStackTrace();}
         public static Vector admin_getAdmins() throws Exception
              checkconnection();
              String message = null;
              Vector v_admins = new Vector();
              ResultSet rs_admins = null;
              stmt_admin_getadmins.registerOutParameter(1 , OracleTypes.CURSOR);
              stmt_admin_getadmins.registerOutParameter(2 , Types.VARCHAR);
              stmt_admin_getadmins.execute();
              message = stmt_admin_getadmins.getString(2);
              System.out.println("message " + message);
              rs_admins = ((OracleCallableStatement)stmt_admin_getadmins).getCursor(1);
              while (rs_admins.next())
                        v_admins.addElement(rs_admins.getString("adminid"));
              rs_admins.close();
              return v_admins;
    CREATE OR REPLACE PACKAGE Admin_conf IS
    TYPE REF_CRSR IS REF CURSOR; /* OUTPUT CURSOR VARIABLE TYPE */
    PROCEDURE RMS_ADMIN_GETALLADMINS(RESULTS OUT REF_CRSR,
                                            OUT_MESSAGE OUT VARCHAR2);
    END Admin_conf;
    CREATE OR REPLACE PACKAGE BODY Admin_conf
    IS
    PROCEDURE RMS_ADMIN_GETALLADMINS(RESULTS OUT REF_CRSR,
                                            OUT_MESSAGE OUT VARCHAR2)
    IS
    l_ref_out_crsr REF_CRSR;
    BEGIN
         OPEN l_ref_out_crsr FOR
         SELECT EXECUTIVE_ID adminid
         FROM MASTER_EXECUTIVE_ID
         ORDER BY EXECUTIVE_ID;
         OUT_MESSAGE := 'ADMIN IDS FETCHED SUCCESSFULLY';
         RESULTS := l_ref_out_crsr;     
    EXCEPTION WHEN OTHERS THEN
              OUT_MESSAGE := 'ERROR ' || SUBSTR(SQLERRM, 1, 60);
    END RMS_ADMIN_GETALLADMINS;
    END Admin_conf;
    Regards
    Ajay Singh Rathod

    Are you actually closing the connections, resultsets in all cases?
    From what you've posted you call
    rs_admins.close();but in that method, you propagate any exceptions that occur out to the caller method, which in turn just prints a stack trace.
    So if an exception occurs before you call the rs_admin.close() the result set will never be closed as the statement won't be reached.
    I'd add a speific exception handling routine to the admin_getAdmins() method and include a finally clause to close the result set in all cases. You can still onthrow the exception if you want.
    cheers
    -steve-

  • Error During Delete Of Application:ORA-01000: maximum open cursors exceeded

    Hello All.
    I am using Apex version 3.2.0.00.27. I am trying to delete an existing application (App_ID 116). I am continually getting ORA-01000: maximum open cursors exceeded.
    Prior to deleting this application, I attempted to, instead, import (that is, replace) this app with a previously saved Apex app (APP_ID 116). This previously saved app is also at the same version. I get the same error. At that point, I figured that I would delete the app and then import my previously saved app, only to get the same error.
    I then attempted to import the previously saved app as a new APP_ID (256). This time, the app imported without error.
    Does anyone know what is going on? Could it be that my existing app 116 is "corrupted" (whatever that means)? Why can't I delete or import over my existing app 116?
    Any help would be appreciated.
    Thank you.
    Elie

    Post Author: amr_foci
    CA Forum: Information OnDemand
    its a database related Error and it can be fixed
    please check this link
    http://publib.boulder.ibm.com/infocenter/wasinfo/v4r0/index.jsp?topic=/com.ibm.support.was.doc/html/EJB_Container/1040875.html
    good luck
    Amr

  • 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

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

    Post Author: prashant
    CA Forum: Information OnDemand
    I successfully created reports using CR4E on windows, deployed JSPS to Websphere running on windows and was able to view a large reports for a using JNDI connection resources to Oracle 10g.
    Every time report is called, it consume 12 cursors from of the database. Open_cursors count is 300. After 24 or 25 iteration of this report, it throws ORA-01000: maximum open cursors exceeded error.
    Has anyone seen this problem, and if so where can I find a hot fix/patch. Any help would very much be appreciated.

    The following code reproduces the problem for me. I thought this was just related to when an exception occurs, and close occurs immediately afterwards. Close finds the exception that occured, and throws it without releasing the resources.
    It's a pain in the ass, that's for sure.
    public void go() {
    try{
    long startTime = System.currentTimeMillis();
    String sql = "Select number_7_0__, char_10__, varchar_5__, varchar2_10__, number_10_5__, float_126__, date_, clob_, blob_ FROM lotsofrows";
    Properties connectProps = new Properties();
    Driver drv = new oracle.jdbc.driver.OracleDriver();
    connectProps.put("user", "borg");
    connectProps.put("catalog", "test");
    connectProps.put("password", "borgborg");
    Connection conn = drv.connect("jdbc:oracle:thin:@142.176.134.166:1521:test", connectProps);
    int cnt = 0;
    while (true) {
    try {
    System.out.print("\nTest " + ++cnt + " ");
    Statement stmt = conn.createStatement();
    System.out.print("execute ");
    ResultSet rs = stmt.executeQuery(sql);
    System.out.print("cancel ");
    stmt.cancel();
    try {
    System.out.print("close.");
    stmt.close();
    } catch (SQLException se) {
    if (se.getMessage().indexOf("requested cancel") != -1) {
    System.out.print("URC:Close");
    try {
    stmt.close();
    } catch (Exception ee) {
    System.out.println(ee.getMessage());
    ee.printStackTrace();
    } else {
    throw se;
    stmt = null;
    }catch(Exception se) {
    System.out.println(se.getMessage());
    se.printStackTrace();
    }catch(Exception e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    null

  • Getting error ora-01000 maximum open cursors exceeded

    hello,
    i am building my fist application using eclipse3.3 hibernate 3.2(hybernatesynchronizer as plugin)
    i have a oracle9i like sgbd . when i trying to create my mapping file from eclipse i got this error :
    ORA-01000: maximum open cursors exceeded
    i try to increase the number of cursor from the oracleconfiguration file init.ora, i shutdown but the problem still
    i don t know how to solve this problem really.
    i need help.

    Yes, that it what I was asking about.Not that it matters, but I think you misunderstood. I meant "if you ask it to leak resources then it will do so." I wasn't asking what you meant.
    Is there a way to make it explicitly open and close via a single call? Perhaps a configuration option either globably or by method/class?Not as a standard part of Hibernate, no. That said, it's relatively hard to leak anything other than connection objects unless you're really trying hard. There are libraries that you can use to manage the lifetime of the connection (actually the session) object. I like the Spring DAO support classes. Inevitably they cause their own problems for someone who doesn't understand what Hibernate's up to under the covers though.
    Edit: Quick example
    // Bog standard Hibernate
    Session session = sessionFactory.openSession();
    try {
       return (List<Foo>)session.createQuery("from Foo").list();
    } finally {
       session.close(); // If omitted will leak a connection object
    // Using Spring
    return (List<Foo>)getHibernateTemplate().find("from Foo");Things get slightly more interesting if you're using lazy loading and actively want to keep the connection around for longer.

  • Error ORA-01000: maximum open cursors exceeded

    Why Oracle return this error. When I change the OPEN_CURSORS in init.ora from 100 to 1000 without this error.
    I want to keep Minimum cursors value. How can I change the Java program ?
    96 er_write_asp('W349','HK','50112','USD',3.99)
    97 er_write_asp('W349','HK','10112','USD',5.22)
    98 er_write_asp('W349','HK','60112','EUR',13.07)
    99 er_write_asp('W349','HK','50112','USD',3.9)
    100 er_write_asp('W349','HK','40112','USD',5.65)
    101 er_write_asp('W349','HK','90112','USD',2.75)
    java.sql.SQLException: ORA-01000: maximum open cursors exceeded
    ORA-06512: at "POSTCAL.ER_WRITE_ASP", line 10
    ORA-06512: at line 1
    java Program list.
         eric.leung 2003/12/02
         set CLASSPATH include C:\Oracle\Ora81\jdbc\lib\classes12.zip
         Purpose
         ===============
         Read text file, write into Oracle Database
    import java.io.*;
    import java.util.StringTokenizer;
    import java.sql.*;
    import java.lang.*;
    import java.math.BigDecimal;
    import java.util.Date;
    public class writeASP {
    // Login Information
    static String user = "x";
    static String passwd = "x";
    static String ip = "x";
    static String getfile = "c:\\temp\\asp.csv";
    public static void main(String[] args) throws IOException {
         String line;
         int i = 0;
         int cnt = 0;
         int port = 0;
         Connection conn;
         Statement stmt;
         String query = "";
         String strone = "";
         String arry[] = {"","","","","","","","","","","","","","",
         // start to connection
         chkArgs(args);     
         FileReader inFile = new FileReader(getfile);
         BufferedReader in = new BufferedReader(inFile);
         try {                
         Class.forName("oracle.jdbc.driver.OracleDriver");
         conn = DriverManager.getConnection("jdbc:oracle:thin:@" + ip + ":1521:lcdx",
              user,passwd);
         stmt = conn.createStatement();
         while((line= in.readLine()) != null)
                   cnt = cnt + 1;
                   StringTokenizer mot = new StringTokenizer(line,",");
              if (mot.countTokens() > 0) {                   
                        for (i = 0; 0 < mot.countTokens() ;i++) {
                             arry[i+1] = "";
                             arry[i] = mot.nextToken();
                        } /* for */
                   } /* if */           
                   strone = arry[0].substring(0,1);
                   if (strone.equals("W")) {
                        //abc(arry);
                        query = "er_write_asp(" +
                        quote(arry[0],',') +
                        quote(arry[1],',') +
                        quote(arry[2],',') +
                        quote(arry[3],',') ;
                        query = query + arry[4] + ")";               
                   System.out.println(cnt + " " + query);
                   CallableStatement cs = conn.prepareCall
                        ("{call er_write_asp(?,?,?,?,?)}");
                   cs.setString(1,arry[0]);
                   cs.setString(2,arry[1]);
                   cs.setString(3,arry[2]);
                   cs.setString(4,arry[3]);
              try {cs.setBigDecimal(5, new BigDecimal(arry[4])); } /*pur_cost */
              catch(NumberFormatException e) {cs.setDouble(5,0);}
                   // System.out.println("Call string: "+ cs.getString());
                   boolean flag = cs.execute();
                   // ResultSet rs = cs.executeQuery();
                   // stmt.executeUpdate();
                   } /* if */
         } /* while */
         conn.close();
         } /* try */
         catch (Exception e) {
              System.err.println(e.toString());          
              } /* Catch */
         in.close();     
    } /* main */
    public static void abc(String g[])
         System.out.print(g[0] + " " + g[1] + " "
              + g[2] + " " + g[3] + " " + g[4] + " "
              + g[5] + " " + g[6] + " " + g[7] + " "
              + g[8] );     
         System.out.println();
    private static String quote(String s)
         return "'" + s + "'";
    private static String quote(String s,char j)
         return "'" + s + "'" + j;
    public static void chkArgs(String[] args) {
         for (int j=0 ; j < args.length;j++) {
              if (args[j].trim().equals("-u")) {
                   if (j + 1 < args.length) {
                        try { user = args[j+1];}
                             catch ( Exception e) {}
              } /* if */
              if (args[j].trim().equals("-p")) {
                   if (j + 1 < args.length) {
                        try { passwd = args[j+1];}
                             catch ( Exception e) {}
              } /* if */
              if (args[j].trim().equals("-i")) {
                   if (j + 1 < args.length) {
                        try { ip = args[j+1];}
                             catch ( Exception e) {}
              } /* if */
              if (args[j].trim().equals("-f")) {
                   if (j + 1 < args.length) {
                        try { getfile = args[j+1];}
                             catch ( Exception e) {}
              } /* if */
              if (args[j].trim().equals("-h")) {
                   help();
                   System.exit(0);
              } /* if */
         } /* for */
    } /* chkArgs */
    public static void help() {
         System.out.println("\nWrite ASP Price Version 1.0 2003/12/02\n");
         System.out.println("Option:");
         System.out.println("\t-i IP Address");
         System.out.println("\t-u User name");
         System.out.println("\t-p Password");
         System.out.println("\t-f File name");
         System.out.println("\t-h Help");
         System.out.println("\nCall Oracle Stored Procdure");
         System.out.println("er_write_ASP(,,,,)");
    } /* help () */
    } /* Class */

    Don't create a new callable statement each pass through the loop. Create it outside the loop and set the parameters & exec inside the loop. Close the resultset each time. Close statement after loop.

  • Oracle and "Maximum open cursors exceeded"

    Hi,
    I am using Weblogic 7.0sp2 with Oracle 9.2.0. Since we are using manual JTA
    transactions and the 9.2 drivers are buggy in that respect, we are using the
    9.0.1 thin drivers delivered with weblogic.
    The problem I have is that after a while, we get the now classic "Maximum open
    cursors exceeded" error on connections from our connection pool (used through
    a
    TX datasource). I have of course checked all our JDBC code and it is fine. We
    do not leave any statement/connection open. In fact, I am certain that the
    problem is not caused by our applicative code.
    The reason I am so positive is that the numbers of open (cached) cursors is
    growing, even though there is no activity on our application (I mean no
    activity at all). The number of cursors is regurlarly increasing by one
    every 5 minutes until it reaches the maximum allowed for a session.
    I have listed the statements corresponding to the opened cursors (they
    do not belong to our code, as you might have guessed):
    SELECT sysdate, user from dual
    select longdbcs from javasnm$ where short = :1
    select longname from javasnm$ where short = :1
    As you can see, there are only three different statements. You can get
    the statements from the system view v$open_cursor for a given session
    but it will only give one row per different statement. If you want to know
    the # of opened cursors in your cursor, use v$sesstat with statistic# = 3
    (opened cursor current).
    I suspect something is wrong in the connection testing done by weblogic
    for the pool (I have activated test on reserved connections and test table
    name is "dual") that leaves a resultset/statement behind. What is weird
    though is that the refresh period is still 0 (not 5 minutes as you would
    expect from the cursor growth rate...).
    I would not say that it is an Oracle bug (as stated in some BEA FAQ I read)
    since our application JDBC code does not exhibit the same problem. The
    problem appeared with recent version of WebLogic for which the session
    cursor cache is enabled, I suppose for performance reasons - this
    is set by isssuing "ALTER SESSION SET SESSION_CACHED_CURSORS = ...".
    Talking about this, does anybody know to which value WebLogic sets this
    parameter when intializing the connection (this is neither
    documented/configurable)?
    Up to now, I have come up with possibly two workarounds, neither of which
    is satisfying:
    - resetting the pool from time to time
    - issuing "ALTER SESSION SET SESSION_CACHED_CURSORS = 0" when I get a
    connection from the pool. I have not tested this one personally (read
    in a newsgroup that someone else did successfully) but it is supposed
    to reset the cursor cache that is causing the trouble.
    Any help will be greatly appreciated,
    Regards,
    Thierry.

    Thierry Rouget wrote:
    Hi,
    I am using Weblogic 7.0sp2 with Oracle 9.2.0. Since we are using manual JTA
    transactions and the 9.2 drivers are buggy in that respect, we are using the
    9.0.1 thin drivers delivered with weblogic.
    The problem I have is that after a while, we get the now classic "Maximum open
    cursors exceeded" error on connections from our connection pool (used through
    a
    TX datasource). I have of course checked all our JDBC code and it is fine. We
    do not leave any statement/connection open. In fact, I am certain that the
    problem is not caused by our applicative code.
    The reason I am so positive is that the numbers of open (cached) cursors is
    growing, even though there is no activity on our application (I mean no
    activity at all). The number of cursors is regurlarly increasing by one
    every 5 minutes until it reaches the maximum allowed for a session.
    I have listed the statements corresponding to the opened cursors (they
    do not belong to our code, as you might have guessed):
    SELECT sysdate, user from dual
    select longdbcs from javasnm$ where short = :1
    select longname from javasnm$ where short = :1
    As you can see, there are only three different statements. You can get
    the statements from the system view v$open_cursor for a given session
    but it will only give one row per different statement. If you want to know
    the # of opened cursors in your cursor, use v$sesstat with statistic# = 3
    (opened cursor current).
    I suspect something is wrong in the connection testing done by weblogic
    for the pool (I have activated test on reserved connections and test table
    name is "dual") that leaves a resultset/statement behind. What is weird
    though is that the refresh period is still 0 (not 5 minutes as you would
    expect from the cursor growth rate...).
    I would not say that it is an Oracle bug (as stated in some BEA FAQ I read)
    since our application JDBC code does not exhibit the same problem. The
    problem appeared with recent version of WebLogic for which the session
    cursor cache is enabled, I suppose for performance reasons - this
    is set by isssuing "ALTER SESSION SET SESSION_CACHED_CURSORS = ...".
    Talking about this, does anybody know to which value WebLogic sets this
    parameter when intializing the connection (this is neither
    documented/configurable)?
    Up to now, I have come up with possibly two workarounds, neither of which
    is satisfying:
    - resetting the pool from time to time
    - issuing "ALTER SESSION SET SESSION_CACHED_CURSORS = 0" when I get a
    connection from the pool. I have not tested this one personally (read
    in a newsgroup that someone else did successfully) but it is supposed
    to reset the cursor cache that is causing the trouble.
    Any help will be greatly appreciated,
    Regards,
    Thierry.Hi. We don't make those queries either. I suspect they are internal to the
    oracle driver. One thing you can try is to set the size of the pool's
    statement cache to zero. Oracle will retain cursors for every statement we
    cache. The alternative is also to tell the DBMS to allow a given session
    more cursors.
    Joe

  • 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?

  • More on "maximum open cursors exceeded"

    It seems a lot of people have been seeing this error message, but reading through the posts on the topic hasn't given me any new insight on the problem. Here's an account of my particular situation:
    I am using the XSQL servlet, v.1.0.0.0 with the thin jdbc driver v.1.x. The servlet is running within an Apache server (1.3.12) on a Linux box, and the Oracle database (8.1.5) is located on a Solaris 2.6 machine.
    The servlet accepts HTTP connections, performs the corresponding SQL queries and returns the output from the database to the HTTP client. Here's a simple example:
    (Sorry about potential bad line breaks.)
    client request:
    % telnet xsql-host.some.domain 80
    Trying xxx.xxx.xxx.xxx
    Connected to xsql-host.some.domain.
    GET /xsql/test/listall.xsql
    <server response here>
    listall.xsql:
    <?xml version="1.0"?>
    <page connection="boss" xmlns:xsql="urn:oracle-xsql">
    <accounts>
    <xsql:query tag-case="lower" rowset-element="" row-element="accountinfo">
    select * from test
    </xsql:query>
    </accounts>
    </page>
    Very simple stuff indeed. Now, this has worked perfectly for 3 weeks or so. During this period, the xsql servlet has been stopped and restarted numerous times and the machine hosting the database has been rebooted at least three times. Then, for no apparent reason (as nothing had changed in the setup described above), I started getting "maximum open cursors exceeded" on every request. Since then, I have been unable to get the system working as it had up until now. I haven't restarted the database and I would like to avoid doing so, because that would not be a valid solution for us if the problem reappeared in production. The maximum open cursors setting in Oracle should be correct, since things were running smoothly before.
    From what I can see, the problem could be with the servlet not closing its cursors. One post mentioned that it did, but I would appreciate it if this could be double-checked. Considering the database is the only portion of the system which has been kept running for extended periods of time, it seems to me that this might indeed be the problem.
    Confirmation, workarounds, suggestions, patches, or a consolation box of chocolates would all be appreciated.
    Thanks,
    - Fad
    ([email protected])
    null

    Check which process is making all the cursors on which database. If it is your procedure, try explicitly closing the cursors. I think the cursors are only implicitely closed after the transaction is ended. If you loop and open a cursor within the loop, that might be the problem.
    I also had this problem with Java working over a JDBC connection some time ago on a 815 database. If I recall correctly, that was caused by the JDBC driver and fixed by replacing it with a JDBC driver of 9i.
    The following script is what I used previously in a program that can draw a graph from the results. It is ugly, but does the job.
    Hope this helps,
    L.
    select
      'max cursors',
      to_number(value)
    from
      v$parameter
    where
      name = 'open_cursors'
    union
    select
      substr(lower(username),1,10)||'('||substr(to_char(ses.sid)||','
      ||to_char(serial#),1,9)||')',
      s.value
    from
      v$sesstat s,
      v$statname n,
      v$session ses
    where
    s.statistic#=n.statistic#
    and ses.sid=s.sid
    and n.name like '%cursor%'
    and n.name like '%current%'
    and not (ses.sid between 1 and 6)

  • Maximum open cursors exceeded!!!

    Hi All,
    While executing a procedure am getting this error:
    Error: ORA-00604: error occurred at recursive SQL level 1
    ORA-01000: maximum open cursors exceeded
    Could you please guide me how to get rid of this kind of error and how to close all open cursors together.
    Thanks in Advance
    AP

    am running a procedure on sqldeveloper and i think statement which is causing problem is:
    RLD is cursor
    in the procedure am checking
    open rld;
    if RLD%found then
    begin
    end;
    end if;
    close rld;
    if i comment IF CONDITION then procedure works fine..

  • Maximum open cursors exceeded with Sybase TG

    Hi,
    Does anyone knows if we can use the HS_OPEN_CURSORS with Oracle transparent gateway for Sybase ?
    I've got the error message :
    ORA-01000: maximum open cursors exceeded
    Thanks

    This depends if the maximum number of cursors exceeded in the GTW or within the db.
    In my eyes the OPEN_CURSORS of the db is normally the limiting factor.
    HS_OPEN_CURSORS defines the maximum number of cursors that can be open on one connection to a non-Oracle system instance.
    The value never exceeds the number of open cursors in the Oracle database server. Therefore, setting the same value as the OPEN_CURSORS initialization parameter in the Oracle database server is recommended.
    So better check out the OPEN_CURSORS of the db and increase them.

Maybe you are looking for