oracle 10g下创建awr报表
--进行相应的授权
CONNECT / AS SYSDBA;
GRANT ADVISOR TO test;
GRANT SELECT_CATALOG_ROLE TO test;
GRANT EXECUTE ON sys.dbms_workload_repository TO test;
--默认情况下,awr每隔一小时创建一个快照,也可以手动执行创建快照的存储过程
conn test/test
SQL> exec sys.dbms_workload_repository.CREATE_SNAPSHOT;
PL/SQL procedure successfully completed.
SQL> exec sys.dbms_workload_repository.CREATE_SNAPSHOT;
PL/SQL procedure successfully completed.
--执行产生报表的脚本
@?/rdbms/admin/awrrpt
--输入你想要的展现格式,html or text
--输入你想要查看多少天内的snap_id
Enter value for num_days: 8 --这里过去8天
--输入begin_snapid
begin_snapid为显示过去8天信息中的Snap Id
--输入end_snapid
begin_snapid为显示过去8天信息中的Snap Id
--输入要保存的文件名
查看每隔多久创建一个快照,以下是每隔一个小时创建一次
SQL> select snap_interval from dba_hist_wr_control;
SNAP_INTERVAL
---------------------------------------------------------------------------
+00000 01:00:00.0
如果没有生成awr报表,查看是否禁用了GATHER_STATS_JOB
SQL> select job_name,job_action,enabled from DBA_SCHEDULER_JOBS;
JOB_NAME JOB_ACTION ENABL
---------------------------------------- ---------------------------------------------------------------------- -----
AUTO_SPACE_ADVISOR_JOB TRUE
GATHER_STATS_JOB TRUE
FGR$AUTOPURGE_JOB sys.dbms_file_group.purge_file_group(NULL); FALSE
PURGE_LOG TRUE
MGMT_STATS_CONFIG_JOB ORACLE_OCM.MGMT_CONFIG.collect_stats TRUE
MGMT_CONFIG_JOB ORACLE_OCM.MGMT_CONFIG.collect_config TRUE
RLM$SCHDNEGACTION begin dbms_rlmgr_dr.execschdactions('RLM$SCHDNEGACTION'); end; TRUE
RLM$EVTCLEANUP begin dbms_rlmgr_dr.cleanup_events; end; TRUE
8 rows selected.