AWR生成标准统计报表

二、生成分析报表

  AWR 是通过对比两次快照(snapshot)收集到的统计信息,来生成报表数据,生成的报表包括多个部分,这点与Statspack生成的报告非常类似。不过AWR在生成报告时,可以选择生成TXT或HTML两种格式的报告,相对来说,HTML更利于阅读,而TXT的适用性更广(即使在不能使用浏览器的机器上也能看)。

  操作过Statspack的朋友都还记的,生成报告使用$ORACLE_HOME/rdbms/admin/spreport.sql脚本,到了AWR这片,操作步骤基本上相同,不过生成报告的脚本多了很多选择,包括:

  • awrrpt.sql :生成指定快照区间的统计报表;
  • awrrpti.sql :生成指定数据库实例,并且指定快照区间的统计报表;
  • awrsqlrpt.sql :生成指定快照区间,指定SQL语句(实际指定的是该语句的SQLID)的统计报表;
  • awrsqrpi.sql :生成指定数据库实例,指定快照区间的指定SQL语句的统计报表;
  • awrddrpt.sql :指定两个不同的时间周期,生成这两个周期的统计对比报表;
  • awrddrpi.sql :指定数据库实例,并指定两个的不同时间周期,生成这两个周期的统计对比报表;

  下面的章节中,我们就来一一例举。

  • 提示:与使用Statspack一样,要想让AWR收集到准确的统计信息,从而生成可靠的性能分析报告,必须将初始化参数STATISTICS_LEVEL的值设置为TYPICAL或ALL。

2.1 生成标准统计报表

  过程并不复杂,下列操作中加粗的部分,是需要指定值的位置(注意,执行报表生成的用户必须拥有DBA角色):

  • JSSWEB> @$ORACLE_HOME/rdbms/admin/awrrpt.sql

    Current Instance

    ~~~~~~~~~~~~~~~~

    DB Id DB Name Inst Num Instance

    ----------- ------------ -------- ------------

    3812548755 TEST08 1 test08

    Specify the Report Type

    ~~~~~~~~~~~~~~~~~~~~~~~

    Would you like an HTML report, or a plain text report?

    Enter ¨html¨ for an HTML report, or ¨text¨ for plain text

    Defaults to ¨html¨

    Enter value for report_type: html

  此处需指定生成的报表格式,有txt和html两种选择,默认情况下为html格式,这里为演示起见,输入html。

  • Type Specified: html

    Instances in this Workload Repository schema

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    DB Id Inst Num DB Name Instance Host

    ------------ -------- ------------ ------------ ------------

    * 3812548755 1 TEST08 test08 yans1

    Using 3812548755 for database Id

    Using 1 for instance number

    Specify the number of days of snapshots to choose from

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Entering the number of days (n) will result in the most recent

    (n) days of snapshots being listed. Pressing without

    specifying a number lists all completed snapshots.

    Enter value for num_days: 2

  此处需指定要读取多少天内的快照信息!

  • Listing the last 2 days of Completed Snapshots

    Snap

    Instance DB Name Snap Id Snap Started Level

    ------------ ------------ --------- ------------------ -----

    test08 TEST08 7330 20 10 月 2009 00:00 1

    7331 20 10 月 2009 01:00 1

    7332 20 10 月 2009 02:00 1

    7333 20 10 月 2009 03:00 1

    7334 20 10 月 2009 04:00 1

    7335 20 10 月 2009 05:01 1

    7336 20 10 月 2009 06:00 1

    7337 20 10 月 2009 07:01 1

    7338 20 10 月 2009 08:00 1

    7339 20 10 月 2009 09:00 1

    7340 20 10 月 2009 10:00 1

    7341 20 10 月 2009 11:00 1

    7342 20 10 月 2009 12:00 1

    7343 20 10 月 2009 13:00 1

    7344 20 10 月 2009 14:00 1

    7345 20 10 月 2009 15:00 1

    7346 20 10 月 2009 16:00 1

    7347 20 10 月 2009 17:00 1

    7348 20 10 月 2009 18:00 1

    7349 20 10 月 2009 19:00 1

    7350 20 10 月 2009 20:00 1

    7351 20 10 月 2009 21:00 1

    7352 20 10 月 2009 22:00 1

    7353 20 10 月 2009 23:00 1

    7354 21 10 月 2009 00:00 1

    7355 21 10 月 2009 01:00 1

    7356 21 10 月 2009 02:00 1

    7357 21 10 月 2009 03:00 1

    7358 21 10 月 2009 04:00 1

    7359 21 10 月 2009 05:00 1

    7360 21 10 月 2009 06:00 1

    7361 21 10 月 2009 07:00 1

    7362 21 10 月 2009 08:00 1

    7363 21 10 月 2009 09:00 1

    7364 21 10 月 2009 10:00 1

    7365 21 10 月 2009 11:00 1

    7366 21 10 月 2009 12:00 1

    7367 21 10 月 2009 13:00 1

    7368 21 10 月 2009 14:00 1

    Specify the Begin and End Snapshot Ids

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Enter value for begin_snap: 7331

    Begin Snapshot Id specified: 7331

    Enter value for end_snap: 7355

    End Snapshot Id specified: 7355

    Specify the Report Name

    ~~~~~~~~~~~~~~~~~~~~~~~

    The default report file name is awrrpt_1_7331_7355.html. To use this name,

    press to continue, otherwise enter an alternative.

    Enter value for report_name:

  此处为要生成的报告指定一个文件名,默认会根据前面输入的snap_id生成一个文件名,比如这里生成的默认文件名为awrrpt_1_7331_7355.html,当然DBA可以根据实际情况对文件名进行自定义。这里就用默认文件名好了,直接回车。

  接下来就不需要DBA再输入什么了,等着ORACLE给你生成报表吧。

  • Using the report name awrrpt_1_7331_7355.html

    ..................

    .......................

     

     

    End of Report

     

    Report written to awrrpt_1_7331_7355.html
    • 本文来源于三思博客!
    • 0
      点赞
    • 0
      收藏
      觉得还不错? 一键收藏
    • 0
      评论
    评论
    添加红包

    请填写红包祝福语或标题

    红包个数最小为10个

    红包金额最低5元

    当前余额3.43前往充值 >
    需支付:10.00
    成就一亿技术人!
    领取后你会自动成为博主和红包主的粉丝 规则
    hope_wisdom
    发出的红包
    实付
    使用余额支付
    点击重新获取
    扫码支付
    钱包余额 0

    抵扣说明:

    1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
    2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

    余额充值