Count number of sessions oracle

— Count number of sessions oracle for 7 days, Provided you keep data that long —

[sourcecode language=”sql”]
select to_char(BEGIN_INTERVAL_TIME,’HH24′), ROUND(SUM(CURRENT_UTILIZATION)/COUNT(*))
FROM DBA_HIST_RESOURCE_LIMIT l,
DBA_HIST_SNAPSHOT ss
where
ss.SNAP_ID = l.SNAP_ID
AND l.RESOURCE_NAME LIKE ‘sessions’
AND STARTUP_TIME between sysdate-7 and sysdate+1
GROUP BY to_char(BEGIN_INTERVAL_TIME,’HH24′)
ORDER BY 1 asc;
[/sourcecode]

Leave a Reply