DBA Hub

📋Steps in this guide1/1

Top running queries from ASH

Query to get list of top running sqls in PAST between sysdate-1 to sysdate-23/34 . You can change accordingly

oracle configurationintermediate
by OracleDba
11 views
1

Top running queries from ASH

Query to get list of top running sqls in PAST between sysdate-1 to sysdate-23/34 . You can change accordingly

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
SELECT active_session_history.user_id,
dba_users.username,
sqlarea.sql_text,
SUM(active_session_history.wait_time +
active_session_history.time_waited)/1000000 ttl_wait_time_in_seconds
FROM v$active_session_history active_session_history,
v$sqlarea sqlarea,
dba_users
WHERE active_session_history.sample_time BETWEEN SYSDATE - 1 AND SYSDATE-23/24
AND active_session_history.sql_id = sqlarea.sql_id
AND active_session_history.user_id = dba_users.user_id
and dba_users.username not in ('SYS','DBSNMP')
GROUP BY active_session_history.user_id,sqlarea.sql_text, dba_users.username
ORDER BY 4 DESC
/

Comments (0)

Please to add comments

No comments yet. Be the first to comment!