Report exceeded opened cursors limit

Hello everyone,
I'm building this report using ref cursors. I've following the steps in "Oracle 9i building reports" document.
My report has 2 ref cursors with a data link between them.
I'm suposing that a cursor is opened once for the main query and then another cursor is opened for each record of the main query in order to fetch joined results. Am i right?
So if the first query return 5000 records the report will open 5001 cursors wich throws ORA-01000 :(
Is there any way to configure the report to close each cursor after it's no longer needed?
Thanks in advance.
DAniel

Hi,
Thanks again for your interest.
That syntax is not allowed at Reports Builder SQL Query resource. Well, at least not with the & characters.
I think I've worked around it.
I built this function (eg. get_data_table) that returns data as a table type, let's say "t_foo"
Then, in my query i wrote:
select a.something, a.something_else from table(get_data_table(:user_p));
user_p is an user parameter. get_data_table returns data from different tables concerning the "user_p" value.
It's working so far :)
Thanks,
Daniel
Edited by: dfgrosso on 6/Abr/2011 6:31

Similar Messages

  • Huge numbers of open cursors mistakenly reported

    Hi,
    We recently received an alert stating:
    Metrics "Current Open Cursors Count" is at 4294966978
    I'm trying to ascertain the source of the erroneous number of open cursors. There also seems to be a very strange graph on the alert page in EM. The graph shows the entire Y axis as: 4294966978, yet the plot moves up and down.
    Investigating the issue, I encountered a statistic even more bizarre. In EM, clicking on the Performance tab, and then selecting "Instance Activity" from the list at the bottom of the page, brings up a chart, and a radio button to switch to "Tabular" view. The Tabular view reports that:
    "opened cursors current" is 2^63-1
    Which is plainly impossible. Has anyone else noted this behavior, or have any insight into the cause of it? Viewing the v$ tables doesn't give anything like the bizarre numbers here.
    Thanks,
    Matt

    Do you see a version number in what you posted?
    Neither do I.
    Surely you don't expect people working an anything from 7.0.12 to 11.1.0.6 to have anything relevant to say with respect to your specific problem without know your operating system and version.
    What metalink docs have you searched looking or the answer?

  • 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

  • JDBC & Open Cursors

    Hi,
    Could it be possible that even if all ResultSet and Statement objects are closed (in finally blocks so that the close() statements are guaranteed to be executed), one can still get ORA 1000 or max open cursors exceeded? Is there a bug in JDBC that makes the cursors linger even though they have been closed by the program? I ask this because a colleague of mine insists that there is such a JDBC bug and that the only workaround is to close the Connection object. He also claims that the "bug" is fixed in Oracle 9i. We are using Oracle 8.1.7.0.0 on HP-UX 11.0 with java 1.3.1 Any info greatly appreciated. Thanks.
    Vasu

    Max cursors open, is the problem encountered because of the database limitation of opening of new sessions. A new database session is created whenever a Statement/PreparedStatament is opened.
    Make sure to close, Statement/PreparedStatement after its usage, as you have done in finally. This will ensure that it wont exceed the maximum open cursor limit.
    I think this is the only cause for the baove problem and can be avoided.
    Hope this helps
    Ravi

  • Maximum Open Cursors Exceeded problem in XSQL

    Hi,
    We are processing an XSQL page by calling XSQLRequest.process() programatically within our application. Within the XSQL page there are several queries which involve multiple nested CURSOR expressions... when the query returns enough rows we are running into the error "ORA-00604: error occurred at recursive SQL level 1 ORA-01000: maximum open cursors exceeded".
    When searching this forum I have seen many (old) postings regarding this error and a bug in the XDK... seems like it was some time ago, but while we set about improving the structure of our XSQL page (or increasing the max open cursor init parameter currently at 500 or both) can anyone confirm that this bug no longer exists?
    Also, any general suggestions on working around this limit rather than increasing it? We have considered splitting up our queries into smaller queries (and merging the results via XSLT) and closing cursors during the session explicitly by issuing commits within the XSQL page... but any better ideas?
    Thanks,
    Bob

    I have found this max open cursors problem to be related to Statement object not being closed. This presents a problem for the use of PreparedStatements, because they are only useful if you can keep them open and resuse them. However, in doing so, each iteration through the PreparedStatement creates another open cursor in the databse rather than reusing the previous one. A work around I discovered by reading about REF CURSORS and I use in JDBC is as follows:
    Assuming a previously prepared PreparedStatement pstmt and a ResultSet rset-
    while (rset.next()) {
    rset.close();
    // This line closes the cursor in the database
    // but does not require you to re-prepare the
    // PreparedStatement. Don't ask me why--ask the
    // Oracle API guys.
    rset.getStatement().close();
    // make ready for GC
    rset = null;

  • Maximum open cursors exceeded and cqj0 trace

    From this morning on the database is reporting the maximum open cursors exceeded in the cqj0 trace. When I see the alert log the error message appear again and again. I try to solve it by setting the open_cursor parameter but the problem do not disappear. I have an oracle rac database 11.1.0.7, OS is Suse Linux Enterprise 10. Also I have configured a local capture process in my database.
    Thank you.

    Hi,
    Please perfrom the following action plan
    1)sql> show parameter cursor_sharing
    2) generate the AWR report for the duration of 60min when you were getting the error and paste the contents of section
    sql ordered by version count
    Kind Regards,
    Rakesh jayappa

  • Maximum open cursors exceeded when reversing

    He llo,
    I get the following zrror when trying to reverse a table from an Oracle Database preventing me to reverse the table:
    java.sql.SQLException: ORA-01000: maximum open cursors exceeded
    Thanks

    Hi Jean,
    I think this is related to the issue I faced a while back.
    Thread: Limit/remove inactive database connections generated by ODI
    My solution was to write a custom linux shell script to kill off old ODI sessions in the database. I scheduled this job to run via the crontab.
    sqlplus -s / <<!
    set feedback off
    set trimspool on
    set pages 9999
    spool /tmp/kill_odi_db_sessions.tmp
    select 'ALTER SYSTEM KILL SESSION '''||sid||','|| serial#||''' immediate;'
    from v\$session
    where username ='<ODI_USER>'
    and status ='INACTIVE'
    and LAST_CALL_ET > 1800
    spool off
    exit
    sqlplus -s / <<!
    @/tmp/kill_odi_db_sessions_$ORACLE_SID.tmp
    exit
    Hope this helps!
    Matt

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

    Hi,
    An exception error ccurred as below while trying to map a column.
    Exception oracle.apps.bne.exception.BneSQLException: SQL Exception in BneFlex.validateSegs: java.sql.SQLException: ORA-01000: maximum open cursors exceeded ORA-06512: at "APPS.FND_MESSAGE", line 525 ORA-06512: at "APPS.FND_MESSAGE", line 565 ORA-06512: at "APPS.FND_MESSAGE", line 654 ORA-06512: at "APPS.FND_MESSAGE", line 766 ORA-06512: at "APPS.FND_MESSAGE", line 741 ORA-06512: at "APPS.FND_FLEX_KEYVAL", line 324 ORA-06512: at line 1 occurred trying to map column: Expense Account.
    In alert log file:
    Errors in file /vol01/oracle/SIT/db/tech_st/10.2.0/admin/SIT_sit/udump/sit_ora_7
    04744.trc:
    ORA-07445: exception encountered: core dump [] [] [] [] [] []
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01000: maximum open cursors exceeded
    ORA-01000: maximum open cursors exceeded
    Thanks
    Edited by: userpat on Aug 15, 2010 5:32 AM

    Hi,
    The issue is different this time after restarting application and database find below.
    An exception occured trying to map a column
    Exception java.lang.ArrayIndexOutOfBoundsException:Array index out of range:1
    occured trying to map column:Category
    in bne.log
    8/18/10 12:08 PM AJPRequestHandler-ApplicationServerThread-2 ERROR BneP
    arentMenuResolver.getMenuItem() MENU 101:BUDGET_NOTE - Menu item excluded becaus
    e IntegratorAppId and Code does not match that of the Top-Most Menu Item or curr
    ent Integrator: 140:FA_MASS_ADDITIONSThe same error is reported in Note: 954462.1 (which is referenced above).
    And also let me clear one doubt. v$open_cursors view is used for what?. The total number of count v$open_cursors is 60,000 whereas the parameter is defined only 2000 in the Instance.Cursors Remain Open (in V$OPEN_CURSOR View) after being Closed [ID 1020427.102]
    Monitoring Open Cursors & Troubleshooting ORA-1000 Errors [ID 76684.1]
    V$OPEN_CURSOR
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2008.htm#REFRN30166
    Thanks,
    Hussein

  • 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

  • Maximum Open cursor  Exceeded error when deleting records from a table

    I have a strange problem.
    I have a table EMP_MASTER . Whenever I am trying to delete a record from this table, I am getting Maximum no. of open cursor exceeded error. But this error doesnot come when i delete from any other tables. And no. of open cursor is much lesser than OPEN_CURSOR parameter.
    All other tables (around 700) has foreign key constraint to this EMP_MASTER table for created_user paramater.
    Is it some thing like, when I am trying to delete a record from EMP_master, implicit cursor opens up and checks all referenced tables. and that limit gets exceeded ?
    Please help.
    Thanks,
    Raj

    Raji03 wrote:
    There is no trigger defined for this table.
    Is there a limit on which no.of references made to a column ? Because one column in this field, Emp no is being referenced in almost every other table. around 700 tables. Will it have any adverse effect ?That should have nothing to do with your problem directly. Again, those tables could have triggers defined on them and you are leaking cursors in one of those triggers (wild guess).
    An example of a table with many many others foreign key'd to it.
    create table parent_of_everything
       column1 number primary key
    insert into parent_of_everything select level from dual connect by level <= 1000;
    commit;
    --create 1000 tables all with foreign keys to the parent_of_everything
    begin
       for i in 1 .. 1000
       loop
          execute immediate 'create table child_' || i || ' (column1 number, column2 number, constraint child_' || i || '_fk foreign key (column1) references parent_of_everything (column1) on delete cascade)';
          execute immediate 'insert into child_' || i || ' select level, mod(level, ' || i || ') from dual connect by level <= 1000';
          commit;
       end loop;
    end;
    TUBBY_TUBBZ?delete parent_of_everything;
    1000 rows deleted.
    Elapsed: 00:02:53.03No problems were had (none were expected).
    Cleanup script.
    --remove the 1000 child tables
    begin
       for i in 1 .. 1000
       loop
          begin
             execute immediate 'drop table child_' || i || ' purge';
          exception when others
             then
                null;
          end;
       end loop;
    end;
    /

  • 'number of open cursors exceeded' exception - 10.3.1

    Hi All,
    We have may DynamicSQL statements fired from our processes due to which we are getting 'number of open cursors exceeded' exception. We don't want to increase the limit of the maximum open cursors. Is there any way to close the cursors explicitly in 10.3.1?
    I am aware that when the iterator fetches the last result the cursor gets closed (in the case of any select query) but we have faced the same issue once/twice in the insert query also, is it because we have fired one insert after the other immediately? How much time does a cursor takes to close (implicitly) in the case of insertion of data?
    Thanks in advance..
    Edited by: GBP on Jan 5, 2011 4:07 AM

    Hi,
    Please see my post: Re: Cursor closing using DynamicSQL.executeQuery
    Hope this helps,
    Ariel

  • How to send email if cursor limit exceeds

    Hi,
    i got an issue like if my cursor limit exceeds, i have to get an email with the error.
    i gave ALTER SYSTEM SET open_cursors = 400 SCOPE=BOTH;
    can any one please help me out.
    Thanks & Regards,
    Lak.

    You can send a mail for ORA-01000 with the help of a trigger. I have written the trigger in the schema level.
    SQL> conn scott@orclsb
    Enter password: *****
    Connected.
    SQL>
    SQL> /** The databse version in which this executed **/
    SQL>
    SQL> SELECT * FROM v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    SQL> /** This package will be used for generating the
    SQL>     ORA-0100: Maximum open cursors exceeded error **/
    SQL> CREATE OR REPLACE PACKAGE test_open_cursor  AS
      2    cursor c01 is select * from dual;
      3    cursor c02 is select * from dual;
      4    cursor c03 is select * from dual;
      5    cursor c04 is select * from dual;
      6    cursor c05 is select * from dual;
      7    cursor c06 is select * from dual;
      8    cursor c07 is select * from dual;
      9    cursor c08 is select * from dual;
    10    cursor c09 is select * from dual;
    11    cursor c10 is select * from dual;
    12    cursor c11 is select * from dual;
    13    cursor c12 is select * from dual;
    14    cursor c13 is select * from dual;
    15    cursor c14 is select * from dual;
    16    cursor c15 is select * from dual;
    17    cursor c16 is select * from dual;
    18    cursor c17 is select * from dual;
    19    cursor c18 is select * from dual;
    20    cursor c19 is select * from dual;
    21    cursor c20 is select * from dual;
    22    cursor c21 is select * from dual;
    23    cursor c22 is select * from dual;
    24    cursor c23 is select * from dual;
    25    cursor c24 is select * from dual;
    26    cursor c25 is select * from dual;
    27    cursor c26 is select * from dual;
    28    cursor c27 is select * from dual;
    29    cursor c28 is select * from dual;
    30    cursor c29 is select * from dual;
    31    cursor c30 is select * from dual;
    32    cursor c31 is select * from dual;
    33    cursor c32 is select * from dual;
    34    cursor c33 is select * from dual;
    35    cursor c34 is select * from dual;
    36    cursor c35 is select * from dual;
    37    cursor c36 is select * from dual;
    38    cursor c37 is select * from dual;
    39    cursor c38 is select * from dual;
    40    cursor c39 is select * from dual;
    41    cursor c40 is select * from dual;
    42  END;
    43  /
    Package created.
    SQL> /** This procedure will be called from the trigger
    SQL>     to send the mail. **/
    SQL> CREATE OR REPLACE PROCEDURE send_cursor_mail AUTHID CURRENT_USER IS
      2    /*** UTL_SMTP related varriable ***/
      3    v_connection_handle  UTL_SMTP.connection;
      4    v_from_email_address VARCHAR2(30) := '[email protected]';
      5    v_to_email_address   VARCHAR2(30) := '[email protected]';
      6    v_smtp_host          VARCHAR2(30) := 'x.xxx.xxx.xxx'; --My mail server, replace it with yours
      7    v_subject            VARCHAR2(300) := 'ORA-0100: Maximum open cursors exceeded';
      8    l_message            VARCHAR2(32767) := 'ORA-0100: Maximum open cursors exceeded';
      9    crlf CONSTANT VARCHAR2(2):=CHR(13) || CHR(10);
    10    /* This send_header procedure is written in the documentation */
    11    PROCEDURE send_header(pi_name IN VARCHAR2, pi_header IN VARCHAR2) AS
    12    BEGIN
    13      UTL_SMTP.WRITE_DATA(v_connection_handle,
    14                          pi_name || ': ' || pi_header || crlf);
    15    END;
    16  BEGIN
    17    v_connection_handle := UTL_SMTP.open_connection(v_smtp_host);
    18    UTL_SMTP.HELO(v_connection_handle, v_smtp_host);
    19    UTL_SMTP.MAIL(v_connection_handle, v_from_email_address);
    20    UTL_SMTP.RCPT(v_connection_handle, v_to_email_address);
    21    UTL_SMTP.OPEN_DATA(v_connection_handle);
    22 
    23    send_header('From', '"Sender" <' || v_from_email_address || '>');
    24    send_header('To', '"Recipient" <' || v_to_email_address || '>');
    25    send_header('Subject', v_subject);
    26    UTL_SMTP.write_data(v_connection_handle, crlf || l_message);
    27    UTL_SMTP.close_data(v_connection_handle);
    28    UTL_SMTP.quit(v_connection_handle);
    29  END;
    30  /
    Procedure created.
    SQL> /** The trigger: This will capture the error and
    SQL>     send a mail **/
    SQL> CREATE OR REPLACE TRIGGER open_cur_servererr
      2    AFTER SERVERERROR ON schema
      3  BEGIN
      4    IF ora_is_servererror(1000) THEN
      5      DBMS_OUTPUT.put_line('ORA-0100: Captured in trigger');
      6      send_cursor_mail; --send the mail
      7      DBMS_OUTPUT.put_line('Mail sent to Saubhik');
      8    END IF;
      9  END;
    10  /
    Trigger created.
    SQL> SET SERVEROUT ON
    SQL>
    SQL> /** Generate the error */
    SQL> BEGIN
      2    FOR i in 1 .. 40 LOOP
      3      execute immediate 'begin open test_open_cursor.c' || to_char(i, 'fm00') ||
      4                        '; end;';
      5    END LOOP;
      6  END;
      7  /
    **ORA-0100: Captured in trigger**
    **Mail sent to Saubhik**
    BEGIN
    ERROR at line 1:
    ORA-01000: maximum open cursors exceeded
    ORA-06512: at "SCOTT.TEST_OPEN_CURSOR", line 30
    ORA-06512: at line 1
    ORA-06512: at line 3
    SQL> Look at the lines ORA-0100: Captured in trigger, Mail sent to Saubhik
    and I have received the mail in my mail address specified in the procedure.

  • 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

  • Open cursors exceeded - common problem, different scenario

    I searched both the web and the java forums and found the "maximum open cursors exceeded" to be a very common problem, one in which I have, but I can't seem to solve it and I was wondering if the way I am doing certain things are causing it.
    Here is my program. I have a java server running that is acting as a midway between a java applet and an Oracle database. Since many users will most likely be using the applet, and since the applet has the ability to alter data in the database, I wanted to Synchronize my database connections.
    So because of this, my server has a static class with all the database calls, including a connection call that connects to the database when it is first started up. Also, I return ResultSets to the server, but I never close either my ResultSet or my Statement. I do this because I only have one global of each of them. Otherwise I would have to close them from the server, and this worries me as far synchronization goes. Thus, with a global statement, I am just reinstantiating it every time. This may very well be my problem.
    Should I?
    1. Not have a single connection to the database but instead create a new connection every time a database call is made?
    2. Do not make the resultset and statement global. (And if this is yes, how would I go about closing them after I return the result set to the server).
    3. Leave the resultset and statement global but go ahead and try to close them from the server.
    4. Or any combination of the above.
    Thanks. I appreciate any help advance. This problem has been driving me insane the last couple of days. If it would help to post my database connections code then I will gladly do so.

    Hmmm. I have worked on it all day and still have nothing. If anyone has even a shred of help, that would be greatl appreciated. I am going to just go ahead and post my code just in case that helps anyone.
    import java.net.*;
    import java.sql.*;
    import java.io.*;
    import oracle.jdbc.driver.*;
    class DBOracleCon
         final static String          DBHostName = "hostname",
                             DBPortNumber = "12345",
                             DBId ="myid";
         final static String          UserName = "user",
                             Password = "password";
         private static Connection con;     
         private static Statement stmt;     
         private static ResultSet rs;
         static protected void dbConnection ()
              try
                   DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                        String dbConnectString =
                        "(DESCRIPTION=(ADDRESS=(HOST=" + DBHostName + ")"+
                        "(PROTOCOL=tcp)(PORT="+ DBPortNumber + "))"+
                        "(CONNECT_DATA=(SID="+ DBId + ")))";
                   con = DriverManager.getConnection(
                            "jdbc:oracle:thin:@"+dbConnectString,
                            UserName, Password);
                          con.setAutoCommit(false);
              catch (Exception e)
                   System.out.println ("Connection Error:" + e);
         static public synchronized Connection returnConnection ()
              return con;
         static protected synchronized ResultSet executeQuery (String query)
              try
                   stmt = con.createStatement();
                   //System.out.println ("QUERY: " + query);
                   rs = stmt.executeQuery (query);
                   return rs;
              catch (Exception e)
                   System.out.println (e);
                   e.printStackTrace();
                   return null;
         static protected synchronized ResultSet executeQuery (PreparedStatement ps)
              try
                   rs = ps.executeQuery();
                   return rs;
              catch (Exception e)
                   System.out.println (e);     
                   e.printStackTrace();
                   return null;
         static protected synchronized void executeUpdate (String query)
              try
                   stmt = con.createStatement();
                   System.out.println ("UPDATE: " + query);
                   stmt.execute (query);
                   commit();
              catch (Exception e)
                   System.out.println (e);
                   e.printStackTrace();
         static protected void executeUpdate (PreparedStatement ps)
              try
                   ps.executeUpdate();
                   commit();
              catch (Exception e)
                   System.out.println (e);     
                   e.printStackTrace();     
         static private void commit ()
              try
                   stmt = con.createStatement();
                   stmt.execute ("commit");
              catch (Exception e)
                   System.out.println (e);
    }Thanks.

Maybe you are looking for

  • Screen recording - recording part of the screen or low resolution

    I want to record part of the screen in quick time x, has anybody found a way to do this? As a work-around, I tried reducing the screen resolution to 640x480 or 800x600 but the recorder doesn't seem to pick anything up at this resolution. After record

  • Monitor Refreshing

    I am upgrading a G4 Quicksilver and on starting OS 9 the screen keeps giving me the desktop all shifted. Can anyone tell me what's wrong with this picture? iMac 800   Mac OS X (10.4.7)   Flat Panel, 768MB and Precious

  • How do I send a scanned document from my 5520 e printer to an e-mail contact

    how do I send a scanned document from printer to e-mail account  (5520 e-all-in-one series

  • Unable to scan doc's using my HP M1536 dnf

    I'm facing some new issue using HP laserjet M1536dnf printer & Scanner, in my office number of systems are there, i can able to give print and scan from all systems accept one system i tried so many settings and troubleshoot's but no use its not work

  • Hi i need a help on sql loader

    Hi all How can i check weather the SQL Loader is installed in my system or not . Thanks and regards goutham