Oracle AWR(Automatic Workload Repository)解析与分析
-- 查询AWR信息示例
SELECT
snap_id AS Snapshot_ID,
dbid AS Database_ID,
instance_number AS Instance_Number,
start_interval_time AS Snapshot_Start_Time,
end_interval_time AS Snapshot_End_Time
FROM
dba_hist_snapshot
ORDER BY
snap_id DESC;
-- 查询指定AWR时间段内的每个等待事件的总等待时间
SELECT
snap_id AS Snapshot_ID,
event AS Wait_Event,
SUM(wait_time) AS Total_Wait_Time
FROM
dba_hist_active_sess_history
WHERE
snap_id BETWEEN :start_snap_id AND :end_snap_id
GROUP BY
snap_id, event
ORDER BY
Total_Wait_Time DESC;
这个例子展示了如何查询AWR快照信息以及如何计算两个指定快照ID之间时间段内所有会话的总等待时间。在实际应用中,你需要替换:start_snap_id
和:end_snap_id
为具体的快照ID。
评论已关闭