oracle 10g下创建awr报表

在oracle 10g下,awr将会取代oracle 9i的statpack报表,它可以提供两种形式的报表,一种是html格式,另一种是text文本格式,这里面的html展现形式看起报表来确实比较直观,也可以轻松的跳越,比如说通过sqlid直接就可以跳越到相应的sql文本上!下面通过参考网络上的一些资料,配置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.

posted on 2008-07-25 18:36  一江水  阅读(2897)  评论(2编辑  收藏  举报