Please use the below query.
SELECT count(prev_sql_id),prev_sql_id,sql_text
FROM v$session LEFT OUTER JOIN v$sql ON v$session.prev_sql_id = v$sql.sql_id
WHERE status=’INACTIVE’
and machine like ‘%servername%’
HAVING COUNT(prev_sql_id)>5
GROUP BY prev_sql_id,sql_text
ORDER BY count(prev_sql_id) DESC;
Recommended Posts