学用ORACLE AWR和ASH特性(8)-生成ASH报表

五、生成ASH报表

  V$ACTIVE_SESSION_HISTORY 视图浏览起来确实方便,不过对于新手朋友其易用性就打了折扣,而且直观性方面也不太好,幸好ORACLE也提供了相应的报表脚本,可以生成指定的时间段内ASH相关的报表。

  ORACLE 提供了两个报表脚本,即可以用来生成数据库级的统计信息,也可以针对RAC架构中某个实例在某个时间段的状态生成统计,下面分别介绍。

1、生成指定时间段时的统计报表

  生成数据库级ASH统计报表使用ashrpt.sql脚本,该文件保存在$ORACLE_HOME/rdbms/admin目录下,基本上操作与AWR脚本非常类似,例如:

SQL>  @$ORACLE_HOME/rdbms/admin/ashrpt.sql

Current Instance

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

   DB Id    DB Name      Inst Num Instance

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

 3812548755 TEST08              1 test08

Specify the Report Type

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

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

Defaults to ¨html¨

Enter value for report_type:  html

  这里让选择生成的报表类型,同样是有html和text两种,默认情况下为html类型。

  选完类型后,接下来会显示数据库的一些基本信息,包括ASH收集到的信息的区间

Type Specified:  html

Instances in this Workload Repository schema

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

   DB Id     Inst Num DB Name      Instance     Host

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

* 3812548755        1 TEST08       test08       yans1

Defaults to current database

Using database id: 3812548755

Defaults to current instance

Using instance number: 1

ASH Samples in this Workload Repository schema

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

Oldest ASH sample available:  09-10 月-09 10:11:02  [  38853 mins in the past]

Latest ASH sample available:  05-11 月-09 09:43:09  [      0 mins in the past]

Specify the timeframe to generate the ASH report

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

Enter begin time for report:

--    Valid input formats:

--      To specify absolute begin time:

--        [MM/DD[/YY]] HH24:MI[:SS]

--        Examples: 02/23/03 14:30:15

--                  02/23 14:30:15

--                  14:30:15

--                  14:30

--      To specify relative begin time: (start with ¨-¨ sign)

--        -[HH24:]MI

--        Examples: -1:15  (SYSDATE - 1 Hr 15 Mins)

--                  -25    (SYSDATE - 25 Mins)

Defaults to -15 mins

Enter value for begin_time:  -10

  输入报表分析的开始时间,这里即可以输入一个时间类型的字串,比如09/23/2009 14:30:15,也可以直接输入时间,甚至更简单的,输入一个负整数例如-10,表示当前时间前10分钟做为开始时间。

Report begin time specified: -10

Enter duration in minutes starting from begin time:

Defaults to SYSDATE - begin_time

Press Enter to analyze till current time

Enter value for duration:  8

  然后要输入统计的时间段,注意哟,不是让输入结束时间,而是说在前面输入的开始时间的基础上,希望收集多长时间内的信息做统计,默认情况下为sysdate-begin_time,即从开始时间到当前时间,这里为了显的与众不同,我就随便敲了个8。

Report duration specified:   8

Using 05-11 月-09 09:33:44 as report begin time

Using 05-11 月-09 09:41:44 as report end time

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

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

Specify the Report Name

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

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

press  to continue, otherwise enter an alternative.

Enter value for report_name: 

  输入报表的名称,默认会根据前面输入的值来生成一个名称,比如这里默认生成的名称为ashrpt_1_1105_0941.html。

Using the report name ashrpt_1_1105_0941.html

Summary of All User Input

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

Format         : HTML

DB Id          : 3812548755

Inst num       : 1

Begin time     : 05-11 月-09 09:33:44

End time       : 05-11 月-09 09:41:44

Slot width     : Default

Report targets : 0

Report name    : ashrpt_1_1105_0941.html

  报表成功生成,可以随时打开ashrpt_1_1105_0941.html浏览详细信息了。

2、生成指定数据库实例的指定时间段时的统计报表

  对于RAC架构的数据库,有时候DBA可能会希望看到其中某个节点(或实例)的负载情况,这种情况下,可以使用ashwrpi.sql(附加的i应该是表示instance),例如:

SQL>  @$ORACLE_HOME/rdbms/admin/ashrpti.sql

Specify the Report Type

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

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

Defaults to ¨html¨

Enter value for report_type:  html

  选择生成的报表文件类型,仍然选择html类型。

Type Specified:  html

Instances in this Workload Repository schema

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

   DB Id     Inst Num DB Name      Instance     Host

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

  948405229         2 JSSDB        jssdbn2      jssdbn2

* 948405229         1 JSSDB        jssdbn1      jssdbn1

Defaults to current database

Enter value for dbid:  948405229

  这里多了两步,首先是要选择数据库的DBID,接下来是选择实例ID。

Using database id: 948405229

Defaults to current instance

Enter value for inst_num:  1

Using instance number: 1

ASH Samples in this Workload Repository schema

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

Oldest ASH sample available:  15-Oct-09 21:24:53   [  29499 mins in the past]

Latest ASH sample available:  05-Nov-09 09:00:56   [      3 mins in the past]

Specify the timeframe to generate the ASH report

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

Enter begin time for report:

--    Valid input formats:

--      To specify absolute begin time:

--        [MM/DD[/YY]] HH24:MI[:SS]

--        Examples: 02/23/03 14:30:15

--                  02/23 14:30:15

--                  14:30:15

--                  14:30

--      To specify relative begin time: (start with ¨-¨ sign)

--        -[HH24:]MI

--        Examples: -1:15  (SYSDATE - 1 Hr 15 Mins)

--                  -25    (SYSDATE - 25 Mins)

Defaults to -15 mins

Enter value for begin_time: 

  输入开始的时间,后面的步骤与前面生成数据库级的操作完全相同,不再演示。

  前面介绍的这种种特性以及脚本均是工具,工具永远都只是起辅助的作用,能不能用好,还是取决于使用工具的人,祝好运吧。



全文完,下载pdf版本请至:http://www.5ienet.com/mydesign/article.asp?/html/rid/113.html

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7607759/viewspace-619571/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/7607759/viewspace-619571/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值