Home » RDBMS Server » Server Administration » Help: Monitoring open_cursors (Oracle 10g R2, Linux)
Help: Monitoring open_cursors [message #522678] Tue, 13 September 2011 02:25 Go to next message
ntt85
Messages: 34
Registered: July 2011
Location: vietnam
Member

Hi all,

When I monitoring db, I see open cursor increase from a machine running Java application. On the develop machine, everything is ok, but on the production server, open cursors can not close.Although the parameters are the same on 2 servers.

Anyone can help me? Thanks a lot.
Re: Help: Monitoring open_cursors [message #522682 is a reply to message #522678] Tue, 13 September 2011 02:32 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
The problem resides in the application that does not close its cursors (or maybe just need more cursor in production than in development which is usually the case).

Regards
Michel
Re: Help: Monitoring open_cursors [message #522686 is a reply to message #522682] Tue, 13 September 2011 02:47 Go to previous messageGo to next message
ntt85
Messages: 34
Registered: July 2011
Location: vietnam
Member

Hi Michel,

I see open cursor in V$OPEN_CURSOR and sure that the cursors can not close. Amount of current open cursors are not so much. However, if they increase continuously, my system will have a performance problem.
My application use Java pool to connect Oracle DB, execute the simple query and free pool after result set returned.
Re: Help: Monitoring open_cursors [message #522689 is a reply to message #522686] Tue, 13 September 2011 02:52 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
However, if they increase continuously, my system will have a performance problem

Not really.

Quote:
My application use Java pool to connect Oracle DB, execute the simple query and free pool after result set returned

This is how you think it works but obvioulsy it does not close the cursors.

Regards
Michel
Re: Help: Monitoring open_cursors [message #522691 is a reply to message #522689] Tue, 13 September 2011 02:56 Go to previous messageGo to next message
ntt85
Messages: 34
Registered: July 2011
Location: vietnam
Member

I think Oracle will have error ORA-01000 when the open cursors reached max.
Can you explain more clearly your idea?
Re: Help: Monitoring open_cursors [message #522693 is a reply to message #522691] Tue, 13 September 2011 03:11 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Which idea? If "open cursors" increases then new cursors are opened and old ones are not closed.

Regards
Michel
Re: Help: Monitoring open_cursors [message #522694 is a reply to message #522693] Tue, 13 September 2011 03:13 Go to previous messageGo to next message
ntt85
Messages: 34
Registered: July 2011
Location: vietnam
Member

So I wanna ask why the cursors can not close when we deploy on production server?
On DEV server, everything are good.
Re: Help: Monitoring open_cursors [message #522702 is a reply to message #522694] Tue, 13 September 2011 03:58 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
So I wanna ask why the cursors can not close when we deploy on production server?
On DEV server, everything are good.

It happens the same thing on both, I bet.

Regards
Michel
Re: Help: Monitoring open_cursors [message #522703 is a reply to message #522702] Tue, 13 September 2011 04:08 Go to previous messageGo to next message
ntt85
Messages: 34
Registered: July 2011
Location: vietnam
Member

Michel Cadot wrote on Tue, 13 September 2011 16:58
Quote:
So I wanna ask why the cursors can not close when we deploy on production server?
On DEV server, everything are good.

It happens the same thing on both, I bet.

Regards
Michel

Hey Michel,
I see open cursors with:
select
a.value
,c.username
,c.machine
,c.sid
,c.serial#
from v$sesstat a
,v$statname b
,v$session c
where a.statistic# = b.statistic#
and c.sid = a.sid
and b.name = 'opened cursors current'
and a.value != 0
and c.username IS NOT NULL
order by 1,2;

On DEV server, open cursor from application is 2. On Production Server it is increasing and now is 570.
I query to v$open_cursor and see the sql_text on Production server have a sql statement make the cursor can not close.
So it doesn't happen the same on the both, I think so.

[Updated on: Tue, 13 September 2011 04:09]

Report message to a moderator

Re: Help: Monitoring open_cursors [message #522704 is a reply to message #522703] Tue, 13 September 2011 04:13 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You have to realize that we have ONLY the information you give.
In same environment Oracle behaves the same.
If Oracle behaves differently then the environments are not the same ones.
If cursors are not closed THEN the reason is the application does not close them.

Regards
Michel

[Edit: missing word]

[Updated on: Tue, 13 September 2011 06:46]

Report message to a moderator

Re: Help: Monitoring open_cursors [message #522710 is a reply to message #522686] Tue, 13 September 2011 05:08 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
ntt85 wrote on Tue, 13 September 2011 08:47
My application use Java pool to connect Oracle DB, execute the simple query and free pool after result set returned.

And you think that closes cursors?

Two things close cursors:
1) Code that explicitly closes cursors
2) Disconnecting the oracle session that holds the cursors.

The whole point of a connection pool is that it avoids point 2 happening.
So you need to have the application explicitly close the cursors.
Re: Help: Monitoring open_cursors [message #522711 is a reply to message #522710] Tue, 13 September 2011 05:14 Go to previous messageGo to next message
ntt85
Messages: 34
Registered: July 2011
Location: vietnam
Member

My application use connection Pool and get result set like:

http://en.wikipedia.org/wiki/Java_Database_Connectivity

I close the result sets by: try { rs.close(); }
So I think the cursor also close.On Dev server,there are not unexpected things happen.

[Updated on: Tue, 13 September 2011 05:17]

Report message to a moderator

Re: Help: Monitoring open_cursors [message #522758 is a reply to message #522711] Tue, 13 September 2011 09:12 Go to previous messageGo to next message
ThomasG
Messages: 3211
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
The FACT is that rs.close() is not called for some reason in the production environment. Probably because the processing loop is running into an exception.

The only way to find out is to look in the logs of the production system.
Re: Help: Monitoring open_cursors [message #522782 is a reply to message #522758] Tue, 13 September 2011 22:18 Go to previous messageGo to next message
ntt85
Messages: 34
Registered: July 2011
Location: vietnam
Member

Thanks all,
I resolved that problem .Very Happy
Re: Help: Monitoring open_cursors [message #522796 is a reply to message #522782] Wed, 14 September 2011 00:53 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
How did you resolve it? What was the root of the problem in the end?

Regards
Michel

[Updated on: Wed, 14 September 2011 00:53]

Report message to a moderator

Re: Help: Monitoring open_cursors [message #522850 is a reply to message #522796] Wed, 14 September 2011 04:06 Go to previous message
ntt85
Messages: 34
Registered: July 2011
Location: vietnam
Member

I replaced the module made problems by new one. I guess rs.close() can not execute in the old application. Sad

[Updated on: Wed, 14 September 2011 04:08]

Report message to a moderator

Previous Topic: nologging issue
Next Topic: table_owner vs schema
Goto Forum:
  


Current Time: Fri Apr 26 04:16:05 CDT 2024