-- QUANTIDADE DE CURSORES ABERTOS / LIMITE
clear columns
COLUMN VALUE FORMAT A20 heading 'LIMITE'
SELECT COUNT(p.VALUE) AS OPEN_CURSORS, p.VALUE
FROM v$sesstat a, v$statname b, v$parameter p, v$session s
WHERE a.statistic# = b.statistic#
AND s.sid=a.sid
AND b.name = 'opened cursors current'
AND p.name = 'open_cursors'
GROUP BY p.VALUE;
-- QUEM ESTA COM CURSORES ABERTOS E A QUANTIDADE
COLUMN username FORMAT A40 heading 'USUARIO'
SELECT s.username, count(*) AS QTD
FROM v$sesstat a, v$statname b, v$session s
WHERE a.statistic# = b.statistic#
AND s.sid=a.sid
AND b.name = 'opened cursors current'
GROUP BY s.username
ORDER BY s.username asc;