Oracle生成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 <return> 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

 

 

 

<HTML><HEAD><TITLE>ASH Report - From 05-11 -09 09:33:44 To 05-11 -09 09:41:44</TITLE>

报表成功生成,可以随时打开 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:

 

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

 

 

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

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

转载于:http://blog.itpub.net/1700919/viewspace-2120781/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值