بدست آوردن تعداد Transactionها در ثانیه بین دو snapshot
راهله شاکری | سه شنبه, ۷ بهمن ۱۳۹۹، ۰۲:۱۱ ب.ظ |
۰ نظر
در دیتابیس اوراکل، تعداد Transactionها در هر ثانیه را، هم میتوان از AWR Report بدست آورد، هم با استفاده از کوئری.
AWR Report:
Query:
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 = 2 AND TO_CHAR (sn.end_snap_time, 'yyyy-mm-dd') = to_char(sysdate, 'yyyy-mm-dd') GROUP BY sn.begin_snap_time, sn.end_snap_time, sn.instance_number ORDER BY 1; |
Result Of above Query: