Max no of cursors opened

Hi all,
For our project we are using Oracle8i as back-end. I am using JDBC api to manipulate the data in the oracle database.
I am getting an error saying that "Max no of cursors opened exceeds limit". This error am freq getting. It causes the table locking.
Is this happening becuase of ResultSet is not closing?
Will ResultSet automatically closed if I close the statment object in finally block of my code or do I need to close the ResultSet explicitly.
Is there any solution for this. This am getting if no of clients are concurantly update the same table.
Any suggestions and solutions appreciated.
thanks in advance
ANILA

It's been asked here before, but I'm embarrassed to confess that I still don't know the answer:
What if you're using a connection pool? My understanding of pools is that they create a pool of live, open connections that an application can draw from. The cost of opening connections is paid once and amortized over all the requests made.
That makes me think that I should leave connections open.
When I do database access with Tomcat, I set up a JNDI connection pool. I have my apps close every ResultSet and Statement, but I don't close the connections. I leave them open to be put back in the pool for the next request to use.
Is this correct? - MOD

Similar Messages

  • Too many Cursors open error

    I have been getting this error in my Jdeveloper App.
    ORA-01000 : maximum open cursors exceeded.
    We have open cursors set at 220. I am using straight JDBC thin
    to call the database (8.1.5) and have been closing ResultSets
    the best I can. It happens after I use the app for a little bit.
    Any suggestions on what is causing this.
    PS
    This is a test database and I am the only one on it.
    Thanks
    Greg
    null

    PreparedStatement ps = null;
    RsultSet rs = null;
    try {
    // Do work here
    } catch (Exception erx) {
    // handle error
    } finally {
    try { rs.close(); } catch {}
    try { ps.close(); } catch {}
    In this way, you should never leave a cursor open.
    null

  • Cursor open error SQLSTT - 72000, SQL code - 969

    We have purchased a product called Access Manager for DB2 and installed it on our AS400. This gives us the connectivitiy to Oracle server with which we do the Warehouse management software interface using our legacy system on AS400.
    I have written several programs in SQLRPGLE and not quite sure as to how I can handle errors coming out of Oracle server.
    As per my knowledge in my programs, I do
    declare cursor
    open cursor
    fetch
    dow look for sqlstate
    fetch next row
    enddo
    close cursor
    I am also new to this much of SQL.
    Now, my programs are running in production and works just fine if we don;t have any issues with oracle server (database server down etc.).
    My question is if the database server goes down for any reason, my SQLRPGLE progam starts giving me cursor not open errors, the actual error is as follows:
    Connection to relational database HJAWCD1 already exists.
    ARDUPAR: ARDUPAR: rc=-1(OCI_ERROR) from OCIStmtExecute when asking for
    Describe-Info
    ARDUPAR(1): ORA-03114: not connected to ORACLE
    ARDAROC: rc = -1 from parse
    SQLSTATE class unknown - SQLSTATE 72000, SQLCODE -969.
    Cursor SEHOST not open.
    Cursor SEHOST not open.
    Cursor SEHOST not open.
    So although, the connection exist between the AS400 and Oracle server as suggested from first statement, but then the cursor is giving me problems of not opening.
    what I would like to know is how do I check in my SQL statement the error and somehow reconnect and open the cursor again.
    Please help in this regard, since I am not finding any help from iseries world becuase no one seems to have knowledge about this product that we have installed and I don;t have too mcuh of documentation on the product nor do I have any sample handling messages program using RPGLE between oracle and AS400 using the product.
    Regards
    Farhan Qadri

    It's been over a decade since I worked on an AS/400 (iSeries), but I've seen an ORA-03114 is thrown from the OCI when you've attempted an illegal statement. That error typically means you are no longer connected to the database. I'd guess that your new application has a defective RPG error management routine.
    Good luck, Michael

  • How can you set the max row for a 'open cursor' in a stored proc?

    I would like to know how can you set the maximum amount of row returned in a resultset coming from a stored proc?
    You can do it via JDBC with cStatement.setMaxRows(10); but it works only for select that you do via JDBC...
    I would like the same functionality using open cursor inside a stored proc...
    Thanks...

    is "where ROWNUM <= 10" the equivalent of "cStatement.setMaxRows(10);" because the ROWNUM as problem with the ORDER BY clause and the setMaxRows() as no problem...

  • PL/SQL leaves cursors open?

    I have been researching into what might look like a resource drain in an Oracle 7.3.4 database we have on a SCO OpenServevr 5.0.5 server.
    There are a couple of applications written in PRO*C (compiled on Solaris with Oracle 8.1.5) always running that keep connections open to the DB. All exchange of data between the apps and the db happens via calls to stored procedures.
    Examining the state of the connections, I noticed that the number of open cursors and UGA/PGA memory used seems to increase over time, and never stabilizes.
    I experimented a bit and noticed that even if I open a session via SQL/PLUS and call an extermely simple procedure that opens a cursors, fetches it, closes it and then commits, the cursor remains open until the session is closed (I examined the session with Toad and Enterprise manager - and cursor cache count is set to 0). Is the open cursor consuming resources (e.g. using precious ram of the SGA) even after the procedure is ended? And if so, how can I release a maximum of resources when my applications are idle, without having to close and reopen the session?
    Thanks, Gaetano Giunta

    If the open cursors are too many then
    ALTER SYSTEM SET CURSOR_SHARING = FORCE;
    Works only with oracle9i
    uv to set ur initparam CURSOR_SHARING=FORCE.
    Which will try using bind variables only.
    Check docs on cursor_sharing may be u may get fair idea on bringing down cursor openings....

  • Multiple cursors opened when following BC4J Entity Association in a loop

    I am using BC4J in JDeveloper 9.0.4.1.1 Build 1436 against a 9.0.2 database.
    (Note the BC4J project was originally created in a 9.0.3 JDeveloper release)
    In the BC4J project, I have a "Contract" Entity that has a 1-to-1 Association with an "Estimate" Entity.
    From my ViewObject, I iterate over a set of Contracts.
    For each Contract, I follow the Association to obtain the Estimate and read a few attributes.
    Occassionally I am running out of cursors in the database whilst using this.
    It seems that each time I access an Estimate using the Association, a new cursor is opened to retrieve the Estimate. These cursors remain open until I complete the loop and the cursor for the VO is closed.
    Therefore, the maximum number of rows returned by the ViewObject is limited to the number of available cursors in the database at the time.
    Why do the cursors remain open after the Entity object has been retrieved?
    Am I using the association incorrectly?

    I wouldn't surprise me if there was a bug in the association code like this.
    For the time being you could just set the where clause and do the query yourself manually on the child vo....

  • FF4 problems - bookmark multiple tabs, cursor, open in new tab

    What's happened to being able to bookmark multiple tabs - I don't need it often but it's really useful when I do. I can't find it in FF4.
    I'm having a problem with my webmail. I used to access the password field with a single click, now I have to click twice before the cursor is active. I run into this problem multiple times a day.
    Open link in new tab: in FF4 I keep opening a new window by mistake - it's really annoying. Why was the position of this command changed in the shortcut menu. I use the command many times a day and my brain is too old to adapt easily.
    Likewise the refresh button has moved. I use this button countless times a day - it's really annoying to find that I can no longer automatically refresh a page.

    The reload button is now on the end of the location bar (where you type web addresses ) by default. It isa stip button whilsta page loads, and a reload button after a page has loaded. There are also options to use completely separate reload and stop buttons, or to add a button to the toolbar that changes between the stop and reload functions.
    The changes may be made without adding any extension, the option used to be called customise (in my en-uk) or customize (en-US) and is now available from
    * Firefox Button -> Options -> toolbar layout ...
    * or by right clicking an empty space on a toolbar
    Note the order of the buttons determines whether it displays as a merged button, or as separate stop and reload buttons.

  • Hovering cursor opens application?

    My Music Director at church has a new Macbook Pro running Snow Leopard and wants to know why applications open when he leaves the cursor setting over the icon in the dock but does not click on it? Is there a setting to turn this feature off.

    Are you sure that you haven't activated the trackpad for tapping?

  • Cursors opening limits

    hi all:
    i have a oracle 9i database with initialization parameter open_cursors set to 500.When my application running,ora-01000 error ocurred.I have queried the dynamic view v$sesstat by "select value from v$sesstat where statistic#=3 and sid=65;" which returned 500.
    I do not want to examine application codes in order to find the sql statements causing the error.So my question is how i can find the sql statements openning 500 cursors.
    thank you.

    Hi,
    You would have to go through the code to check. Whether you are closing all record sets and statements properly. If yes then no way but to increase the number in your initialization parameter file.
    All the best
    Aarbi

  • Cursors remained open after closing connection

    I am using OC4J 10g (Application Server) and Oracle10g DB. OC4J is maintaining the connection pool(com.evermind.sql.DriverManagerDataSource). I get the connection from pool and call DB procedure, then close resultset, statement and connection. It closes the opened cursors against resultset. But left some implicit cursors opened and never closed so cursor count is going to increase.
    If i dont use pool no cursor remained open and count is zero. It means the cursors of pooled connections are not closed.
    wait-timeout="60"
    min-connections="5"
    max-connections="100"
    inactivity-timeout="15"
    <property name="stmt-cache-size" value="2000"/>
    Tahir

    Hi Justin,
    Thnx for your reply and you're understanding is correct but the problem I face is when multiple concurrent users access the JSP page from which I'm actually calling the servlet to retrieve the image, the number of cursors being left open increases. As the load on the page increases (i.e. no of usesrs increase) oracle seems to have problems in garbage collecting the open cursors ... which eventually leads it to throw maximum cursors exceeded exceptions.
    Any suggestions ?
    -Athar

  • 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

  • Avg number of open cursors per session

    We've been noticing a large number of open cursors open per session in our database, these users being Oracle Forms users. There are quite a few 'bells & whistles' in this vendor-supplied application with many round trips to the database. The warning we were receiving was induced by an alert that we had set up within OEM.
    It got me wondering then, what a large number of cursors per process really was. We're seeing between 10-80 open cursors. The init parm OPEN_CURSORS has a default value of 50 upon installation (which is per session), so the max of 80 doesn't seem too much higher.
    Are we really experiencing a large # of open cursors per session? Does someone have a means of estimating the max # of cursors that one would expect based upon CPU & memory resources? I can't find anything in the documentation.
    Thanks,
    Chuck

    There is an OPEN_CURSORS parameter in the init.ora file,
    I want to know the impact of number of open cursors on performance
    (ie., how many open cursors would be appropriate for an instance)There shouldn't be a performance issue here. The value needs to be set based on how many open cursors you want to allow simultaneously. If you set the value too low, applications will get the "too many cursors open" error when they try to open a new cursor. If you're not having problems, or if you don't know how many open cursors you're likely to have, I wouldn't change this parameter.
    Justin

  • Understanding Open Cursor

    Hi All, I am confused on this open cursor as I would like to understand further if I am hitting my limit. Currently I do not see the error that my open cursor exceeded.
    If I add up the a.value on the second sql, I am getting more than 10k, but my open cursor is only set to 5000. I must be calculating this wrongly here.
    open cursor = 5000
    session_cached_cursors 200
    select max(a.value), a.sid, b.program
    from v$sesstat a, v$session b, v$statname c
    where a.sid = b.sid
    and a.statistic# = c.statistic#
    and c.name = 'opened cursors current'
    group by a.sid, b.program
    order by 1 desc
    MAX(A.VALUE) SID PROGRAM
    2201 596
    516 514 abc@server1 (TNS V1-V3)
    401 720 abc@server1 (TNS V1-V3)
    602 670 abc@server1 (TNS V1-V3)
    578 445 abc@server1 (TNS V1-V3)
    129 rows selected.
    Would like to know what is the current open cursor count?
    If I get the sid like above, can I know what SQL is holding it up?

    What total do you get if you use the query from this article? See 'Monitoring open cursors'. Note that it includes serial#
    http://www.orafaq.com/node/758
    --total cursors open, by session
    select a.value, s.username, s.sid, s.serial#
    from v$sesstat a, v$statname b, v$session s
    where a.statistic# = b.statistic#  and s.sid=a.sid
    and b.name = 'opened cursors current';
    If I sum up the a.value it is again more than 10k but the highest a.value is only 2000+
    OPEN_CURSORS specifies the maximum number of open cursors (handles to private SQL areas) a session can have at once. Since it is saying open cursor by a single session. I would suppose my max value now is 2000+ while my max_cursor set is 5000. Am I right?

  • Open cursors and shared cached cursors

    Hi
    In addm report i found below recommendation, before any change in parameter i want to know about those parameters, is there any thumb rule for this parameters,
    is there any drawback if i increase those parameters.
    FINDING 7: 2.1% impact (10693 seconds)
    Soft parsing of SQL statements was consuming significant database time.
    RECOMMENDATION 1: Application Analysis, 2.1% benefit (10693 seconds)
    ACTION: Investigate application logic to keep open the frequently used
    cursors. Note that cursors are closed by both cursor close calls
    and
    session disconnects.
    RECOMMENDATION 2: DB Configuration, 2.1% benefit (10693 seconds)
    ACTION: Consider increasing the maximum number of open cursors a
    session
    can have by increasing the value of parameter "open_cursors".
    ACTION: Consider increasing the session cursor cache size by
    increasing
    the value of parameter "session_cached_cursors".
    RATIONALE: The value of parameter "open_cursors" was "300" during the
    analysis period.
    RATIONALE: The value of parameter "session_cached_cursors" was "20"
    during the analysis period.
    Thanks and Regards
    Jafar

    Jaffy
    Your system suffers from soft parsing (according to ADDM), therefore:
    - Increasing the value of open_cursors has no impact on soft parsing (only up to 9.2.0.4 open_cursors had a direct impact on that for PL/SQL programs).
    - Increasing the value of session_cached_cursors might help reducing soft parsing. If it helps or not is really dependent from the application.
    ADDM is probably advising to increase open_cursors as well, because the database engine will keep cursors open even if the application closes them.
    HTH
    Chris
    PS: cursor_sharing might be helpful to reduce hard parses. It has no impact on soft parses... So, forget the hint about it.

  • Viewer leaving open cursors in Oracle

    We are using the JRC to display reports in our software. We are running jboss-4.2.0 as our application server. The backend could be either SQL Server or Oracle. For Oracle we are using the oracle.jdbc.driver.OracleDriver driver. The reports are set up using a JDBC (JNDI) connection. Generally we have it working ok but in Oracle the JRC is leaving open cursors leading to  ORA-01000: MAXIMUM OPEN CURSORS EXCEEDED. I have found that a new cursor is opened when the data source is changed in the following code snippet
    Iterator tableIT = tableNames.iterator();
    while (tableIT.hasNext()) {
      ITable oldTable = (ITable)tableIT.next();
      ITable table = (ITable) ((IClone)oldTable).clone(true);
      table.setQualifiedName(table.getName());
      clientDoc.getDatabaseController().setTableLocation(oldTable, table);
    When we hit the last line in this loop, a new cursor is opened in Oracle so if a report has 10 tables, I get 10 cursors opened. I know that I need to close the cursors somehow but nothing I do seems to make a difference. After my processHttpRequest call to the viewer I added:
    crystalReportPageViewer.getReportSource().dispose();
    clientDoc.getReportSource().dispose();
    The code definately executes but the the number of open cursors in Oracle does not change. I am at a loss.

    A couple more things to think about then.
    1.  When you go through your loop to set your table location, you are using the clone method to create a new table and then pass that table to the report.  Cloning tables is no longer necessary with the JRC.  We do know that a fix was provided for the JRC SDK, however this fix would probably not have been applied to the clone method since it has been deprecated.
    I have attached a sample that shows the new methodology for setting table location; very similar, just not using clone anymore.
    2.  When you want to destroy any connections that the ReportClientDocument has made, you will need to call .close() on this object.  This can be done in conjunction with the viewer.dispose().  One thing to note is that if you call the .close() method, it will need to be done as the user is closing the browser, or you will not have access to your report object when you have it open in the HTML Viewer.

Maybe you are looking for

  • How to recover my notebook at factory - out of box settings with recovery DVD's.

    Due to hard disk crash i formatted my hard disk, also deleted all partitions including HP Tools and HP Recovery partitions. But I have my recovery DVD of my notebook that i have created at the time of notebook purchase. When i Inserted First Disc of

  • Access to modules keys in my module adapter

    Hi experts, I develop adapter module and it works fine, but I need to access module keys in my adapter module and i can't find any documentation on it. Please could you provide me links or code examples for it. Maxim.

  • Handling very large diagrams in Pages?

    I am writing a book that requires sometimes the use of large diagrams. These are vector-based diagrams (PDF). Originally, I planned to use iBooks Author and widgets to let the user zoom/pan/scroll and use other nice interactive stuff, but after havin

  • Zen Micro Photo Li

    Can somone give me a link to where i can buy a Zen Micro Photo Pink? I li've in the USA, Thanks alot, Sorry i did not find this on search.

  • Manual for 5300

    Does anyone have or have the link for the Manual for the Inspire 5300 speakers? The only thing on the site is a quick reference guide.