Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Enterprisemanager and Session Details -> Open Cursers: are they really open?

Re: Enterprisemanager and Session Details -> Open Cursers: are they really open?

From: Brian Peasland <dba_at_nospam.peasland.net>
Date: Tue, 12 Sep 2006 17:27:13 GMT
Message-ID: <J5HptK.Fu1@igsrsparc2.er.usgs.gov>


> That there are some cursors that are open is not a problem.
>
> But i as a programmer know that i have to close a cursor that is not
> used any longer. If i don't, i eventually will get an "to many open
> cursors" error.

If your code explicitly opens a cursor, then explicitly close it as soon as you are done with the cursor. In my code, I don't even open the cursor until right before my loop that will process the cursor's contents. And as soon as that loop has finished executing, my code closes the cursor.

> If i used the API to close a cursor but find this cursor still open i
> have to look for bugs.

Is this a concern with your code or some vendor's code? If it is your code, then closing the cursor as soon as you are done with it will solve the problem. If it is the vendor's code, then it is up to the vendor to tackle this issue.

> I can't wait until a customer finds "to many open cursors".

They could anyway if they are using your application on their database. They would have control over the total number of open cursors allowed by setting their init parms.

Also keep in mind that many of the open cursors you see are not opened explicitly. They are implicit cursors. Any time you issue SQL against the database, a cursor is opened whether you explicitly did it or not. So in SQL*Plus, if I issue "SELECT sysdate FROM dual;", I have caused a cursor to be opened. As soon as I get the results back, the cursor is closed. Yet I have not issued the "CLOSE_CURSOR" command for my environment. And the system is issuing SQL all the time, behind the scenes. If you have Enterprise Manager monitoring the database, there are lots of open cursors as well.

HTH,
Brian

-- 
===================================================================

Brian Peasland
dba_at_nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown
Received on Tue Sep 12 2006 - 12:27:13 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US