-- cur.sql: sessions holding more than N open cursors, grouped by machine and SQL -- Copyright (c) HASHJOIN. MIT License (https://hashjoin.com/kb/license/) -- https://hashjoin.com/kb/oracle/open-cursors-by-session/ -- -- Usage: @cur.sql -- @cur.sql 200 set lines 132 set trims on col machine format a35 select count(*), inst_id, machine,status,sql_id,prev_sql_id from gv$session where (inst_id,sid) in (select st.inst_id, st.sid from gv$sesstat st, v$statname n where st.statistic# = n.statistic# and n.name = 'opened cursors current' and st.value > &&1) group by inst_id,machine,status,sql_id,prev_sql_id; undefine 1