It is currently Wed Feb 08, 2012 6:37 am


Post a new topicPost a reply Page 1 of 1   [ 1 post ]
Author Message
 Post subject: Exception ORA-01000 too many open cursors
PostPosted: Sun Nov 16, 2008 3:36 pm 

Joined: Tue Nov 11, 2008 11:06 am
Posts: 15
Hi Everybody...


While working on an enterprise application I was making a loop to insert records in the database using a PreparedStatement in the beginning I forgot the close the prepared statement each time I finish executing the statement and I was inserting the records in a while loop which goes on for like 1000 records.

When trying this I got the exception Exception ORA-01000 too many open cursors
When searching for the cause of the problem I found that oracle creates a new cursor object in the DBMS and because I was not closing prepared statements the cursors was all the time there and they were increasing until they exceed the number defined in the oracle parameter OPEN_CURSORS

I used the following to get the number of open cursors

Code:
SELECT v.value as numopencursors ,s.machine ,s.osuser,s.username
FROM V$SESSTAT v, V$SESSION s
WHERE v.statistic# = 3 and v.sid = s.sid


Finally I solved the problem by creating few prepared statements and just changing the parameters every time I'm gonna execute (which is why there are prepared statements from the first place)
:D


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 1 post ]


Who is online

Registered users: Spanteeirrela


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
twilightBB Style by Daniel St. Jules of Gamexe.net

[
SEO MOD © 2007 StarTrekGuide ]