Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1206973
  • 博文数量: 350
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 5668
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-23 17:53
文章分类

全部博文(350)

文章存档

2013年(350)

分类: Oracle

2013-04-27 09:58:21

二、生成分析

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

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

  • awrrpt.sql :生成指定快照区间的统计报表;
  • awrrpti.sql :生成指定实例,并且指定快照区间的统计报表;
  • awrsqlrpt.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. Pressingwithout

    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,

    pressto 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

  打开最终生成的统计报表,界面如下:

    提示:

    问:前面提示输入snaps时哪来的这么多snapshots啊?

    答:这都是ORACLE偷偷摸摸一点一点(每小时一次)收集的啊!

    问:它究竟收集了多久的啊?

    答:从当前的记录看,至少有7天了!

    问:究竟啥是snapshot啊?

    答:接着往下看!


查看之前的文章:

==============================================

阅读(1967) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~