PLSQL导出awr报告

发布时间 2023-08-23 20:57:12作者: 那一缕清风

begin
dbms_workload_repository.create_snapshot();
end;

1、准备
查询dbid
select dbid from v$database;
查询instance_number
select instance_number from v$instance;
查询历史快照
select SNAP_ID,dbid,SNAP_LEVEL,BEGIN_INTERVAL_TIME from dba_hist_snapshot order by SNAP_ID desc;
2、生成报告
AWR关注数据库的整体性能报告
select output from table(dbms_workload_repository.awr_report_html
(v_dbid, v_instance_number,v_min_snap_id,v_max_snap_id
));

3、导出查询结果,粘贴到文档中,保存为html格式