Friday, September 21, 2007

How to find out JDBC statement leaks in Oracle

Serious leaks can be identified with then following SQL (10g):
select oc.inst_id, oc.sid, oc.hash_value, oc.sql_text, count(*)
from gv$open_cursor oc
where sql_text not like 'COMMIT%'
group by inst_id, sid, hash_value, sql_text
having count(*) > 5
order by 5;

9i or belower use v$open_cursor instead of gv$open_cursor