Number of Transactions (per second)
WITH
hist_snaps
AS
(SELECT instance_number,
snap_id,
ROUND (begin_interval_time, 'MI') begin_snap_time,
ROUND (end_interval_time, 'MI') end_snap_time,
( begin_interval_time
+ 0
- LAG (begin_interval_time + 0)
OVER (PARTITION BY dbid, instance_number
ORDER BY snap_id))
* 86400 diff_time
FROM dba_hist_snapshot),
hist_stats
AS
(SELECT dbid,
instance_number,
snap_id,
stat_name,
VALUE
- LAG (VALUE)
OVER (PARTITION BY dbid, instance_number, stat_name
ORDER BY snap_id) delta_value
FROM dba_hist_sysstat
WHERE stat_name IN ('user commits', 'user rollbacks'))
SELECT sn.begin_snap_time,
sn.end_snap_time,
sn.instance_number,
ROUND (SUM (delta_value) / 3600) "TRANSACTIONS/S"
FROM hist_snaps sn, hist_stats st
WHERE st.instance_number = sn.instance_number
AND st.snap_id = sn.snap_id
AND sn.diff_time IS NOT NULL
AND sn.instance_number = 1
AND TO_CHAR (sn.end_snap_time, 'yyyy-mm-dd') = TO_CHAR (sysdate-1, 'yyyy-mm-dd')
GROUP BY sn.begin_snap_time, sn.end_snap_time, sn.instance_number
ORDER BY 1;