Oracle Maximum opened cursors exceeded

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Oracle Maximum opened cursors exceeded

Santiago Cardoso Geller
I tried the following on a DBConnection inspector:

        | indexes |
        indexes := OrderedCollection new.
        self tables do: [ :aTable |
                indexes add: (self indicesOf: aTable type: 1) ].

        ^indexes

In Oracle I have the problem that the number of opened cursors are over 300 (my limit).
Is there any way to close cursors in the middle of the "do:" process?
Thanks,
Santiago


Reply | Threaded
Open this post in threaded view
|

Re: Oracle Maximum opened cursors exceeded

Christopher J. Demers
Santiago Cardoso Geller <[hidden email]> wrote in message
news:[hidden email]...
...
> In Oracle I have the problem that the number of opened cursors are over
300 (my limit).
> Is there any way to close cursors in the middle of the "do:" process?

I have not done exactly what you are doing, so perhaps someone with more
context specific knowledge can provide a more appropriate answer.  However I
have run into similar DB resource exhaustion issues in tight loops with many
queries.  The solution has usually be to include a slight delay in order to
force a garbage collection.

ex: (Delay forMilliseconds: 600) wait

I am not sure exactly how much time is required, I am using 600 ms in one of
my loops.  If you use a counter you might be able to use the delay every 50
iterations or something if speed is important.  If you do a news archive
search I suspect you will see some previous discussion about this issue.

Chris


Reply | Threaded
Open this post in threaded view
|

Re: Oracle Maximum opened cursors exceeded

Blair McGlashan
In reply to this post by Santiago Cardoso Geller
Santiago

You wrote in message news:[hidden email]...

> I tried the following on a DBConnection inspector:
>
> | indexes |
> indexes := OrderedCollection new.
> self tables do: [ :aTable |
> indexes add: (self indicesOf: aTable type: 1) ].
>
> ^indexes
>
> In Oracle I have the problem that the number of opened cursors are over
300 (my limit).
> Is there any way to close cursors in the middle of the "do:" process?

The attached implementation of DBConnection>>indicesOf:type: (from Dolphin
5.0) does precisely that.

Another approach would be to insert a 'MemoryManager current
administerLastRites' into your loop.

Regards

Blair

------------------
!DBConnection methodsFor!

indicesOf: aString type: anInteger
 "Answer a list of the indices on the table named aString
 of type anInteger"

 | stmt answer |
 stmt := DBStatisticsStatement parent: self.
 stmt
  tableName: aString;
  type: anInteger;
  accurate: true.
 answer := stmt results asOrderedCollection.
 stmt free.
 ^answer! !
!DBConnection categoriesFor: #indicesOf:type:!enquiries!public! !


Reply | Threaded
Open this post in threaded view
|

Re: Oracle Maximum opened cursors exceeded

Santiago Cardoso Geller
In reply to this post by Christopher J. Demers
On Wed, 20 Feb 2002 22:13:01 -0500, "Christopher J. Demers" <[hidden email]> wrote:

> Santiago Cardoso Geller <[hidden email]> wrote in message
> news:[hidden email]...
> ....
> > In Oracle I have the problem that the number of opened cursors are over
> 300 (my limit).
> > Is there any way to close cursors in the middle of the "do:" process?
>
> I have not done exactly what you are doing, so perhaps someone with more
> context specific knowledge can provide a more appropriate answer.  However I
> have run into similar DB resource exhaustion issues in tight loops with many
> queries.  The solution has usually be to include a slight delay in order to
> force a garbage collection.
>
> ex: (Delay forMilliseconds: 600) wait
>
> I am not sure exactly how much time is required, I am using 600 ms in one of
> my loops.  If you use a counter you might be able to use the delay every 50
> iterations or something if speed is important.  If you do a news archive
> search I suspect you will see some previous discussion about this issue.
>
> Chris
>
>


Thank you Chris. The delay works fine.

Santiago


Reply | Threaded
Open this post in threaded view
|

Re: Oracle Maximum opened cursors exceeded

Santiago Cardoso Geller
In reply to this post by Blair McGlashan
Blair McGlashan wrote:

>Santiago
>
>You wrote in message news:[hidden email]...
>> I tried the following on a DBConnection inspector:
>>
>> | indexes |
>> indexes := OrderedCollection new.
>> self tables do: [ :aTable |
>> indexes add: (self indicesOf: aTable type: 1) ].
>>
>> ^indexes
>>
>> In Oracle I have the problem that the number of opened cursors are over
>300 (my limit).
>> Is there any way to close cursors in the middle of the "do:" process?
>
>The attached implementation of DBConnection>>indicesOf:type: (from Dolphin
>5.0) does precisely that.
>
>Another approach would be to insert a 'MemoryManager current
>administerLastRites' into your loop.
>
>Regards
>
>Blair
>
>------------------
>!DBConnection methodsFor!
>
>indicesOf: aString type: anInteger
> "Answer a list of the indices on the table named aString
> of type anInteger"
>
> | stmt answer |
> stmt := DBStatisticsStatement parent: self.
> stmt
>  tableName: aString;
>  type: anInteger;
>  accurate: true.
> answer := stmt results asOrderedCollection.
> stmt free.
> ^answer! !
>!DBConnection categoriesFor: #indicesOf:type:!enquiries!public! !
>
>

Thank you Blair. I fix the implementation of #indicesOf:type: with
your code. It works very fine.

Santiago