对于ASH,一直没有用过,原因是一直觉得awr就够了,所以很少去考虑或者研究ASH,今天圣诞节,赠给自己一个福利吧,研究一下ASH。如果awr默认间隔是1h,那如果我们想收集最近一小时的数据的话,就需要使用ASH了,使用$ORACLE_HOME/rdbms/admin/ashrpt.sql来收集。
ASH的一些特性:
1. 每秒采用一次,只采样活动的session。由MMNL进程完成采样。
2. 数据记录在内存中,大小为1M-30M之间,一般记录近一小时内的内容,超过1h的,可以去awr中查
3. 可以理解为ASH和AWR是一家的东西,近一小时的看ASH,超过1h的看AWR。
收集ASH:
SQL> @$ORACLE_HOME/rdbms/admin/ashrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
3400117082 ORCLRAC 2 ORCL2
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type:
Type Specified: html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------ ------------ ------------
* 3400117082 2 ORCLRAC ORCL2 ORCLRAC2
3400117082 1 ORCLRAC ORCL1 ORCLRAC1
Defaults to current database
Using database id: 3400117082
Defaults to current instance
Using instance number: 2
ASH Samples in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Oldest ASH sample available: 17-Dec-13 00:00:25 [ 12502 mins in the past]
Latest ASH sample available: 25-Dec-13 16:22:46 [ 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: -60
Report begin time specified: -60 ---输入-60表示起始时间为1h前
Enter duration in minutes starting from begin time:
Defaults to SYSDATE - begin_time
Press Enter to analyze till current time
Enter value for duration: ----结束时间,默认是当前
Report duration specified:
Using 25-Dec-13 15:23:15 as report begin time
Using 25-Dec-13 16:23:27 as report end time
--------------省略.............................
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is ashrpt_2_1225_1623.html. To use this name,
press
Enter value for report_name: ----文件的名字,回车就行
Using the report name ashrpt_2_1225_1623.html
..................................................
刚看了下ASH的收集报告,和AWR差不多。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24500180/viewspace-1064357/ ,如需转载,请注明出处,否则将追究法律责任。