Oracle AWR报告的生成和解读
-- 查询AWR报告的基本信息
SELECT * FROM DBA_HIST_SNAPSHOT WHERE SNAP_ID = 1023;
-- 查询指定时间段内的AWR报告
SELECT * FROM DBA_HIST_ACTIVE_SESS_HISTORY WHERE SAMPLE_TIME BETWEEN TO_TIMESTAMP('2023-04-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') AND TO_TIMESTAMP('2023-04-02 00:00:00', 'YYYY-MM-DD HH24:MI:SS');
-- 查询指定时间段内的AWR性能指标
SELECT
snap_id,
dbid,
AVG(cpu_time) / 1000000 AS avg_cpu_s,
AVG(executions) AS avg_exec,
AVG(parse_calls) AS avg_parse,
AVG(disk_reads) AS avg_disk_reads,
AVG(buffer_gets) AS avg_buffer_gets,
AVG(rows_processed) AS avg_rows_proc
FROM
DBA_HIST_SQLSTAT
WHERE
snap_id BETWEEN 1023 AND 1033
GROUP BY
snap_id, dbid;
这个例子展示了如何查询AWR报告的基本信息,以及如何查询特定时间段内的AWR性能指标。这些查询可以帮助数据库管理员分析数据库的性能变化,从而制定出相应的优化策略。
评论已关闭