To get the Most Active SQL in the previous hour


SELECT
sql_id,COUNT(*),ROUND(COUNT(*)/SUM(COUNT(*)) OVER(), 2) PCTLOAD
FROM
gv$active_session_history
WHERE
sample_time > SYSDATE – 1/24
AND
session_type = ‘BACKGROUND’
GROUP
BY sql_id
ORDER
BY COUNT(*) DESC;

SELECT
sql_id,COUNT(*),ROUND(COUNT(*)/SUM(COUNT(*)) OVER(), 2) PCTLOAD
FROM
gv$active_session_history
WHERE
sample_time > SYSDATE – 1/24
AND
session_type = ‘FOREGROUND’
GROUP
BY sql_id
ORDER
BY COUNT(*) DESC; 
Recent Posts