Oracle AWR 介绍
来源:互联网 发布:红中麻将源码教程 编辑:程序博客网 时间:2024/04/29 15:19
Oracle AWR 介绍
Oracle Database 10g 提供了一个显著改进的工具:自动工作负载信息库 (AWR:Automatic WorkloadRepository)。Oracle 建议用户用这个取代 Statspack。
AWR 实质上是一个 Oracle 的内置工具,它采集与性能相关的统计数据,并从那些统计数据中导出性能量度,以跟踪潜在的问题。与Statspack 不同,快照由一个称为 MMON 的新的后台进程及其从进程自动地每小时采集一次。
为了节省空间,采集的数据在 7 天后自动清除。快照频率和保留时间都可以由用户修改。
它产生两种类型的输出:文本格式(类似于 Statspack 报表的文本格式但来自于 AWR 信息库)
和默认的 HTML 格式(拥有到部分和子部分的所有超链接),从而提供了非常用户友好的报表。
AWR 使用几个表来存储采集的统计数据,所有的表都存储在新的名称为 SYSAUX 的特定表空间中的 SYS 模式下,并且以WRM$_* 和 WRH$_* 的格式命名。
前一种类型存储元数据信息(如检查的数据库和采集的快照),后一种类型保存实际采集的统计数据。
H 代表“历史数据 (historical)”而 M 代表“元数据 (metadata)”。
在这些表上构建了几种带前缀 DBA_HIST_ 的视图,这些视图可以用来编写您自己的性能诊断工具。视图的名称直接与表相关;
例如,视图 DBA_HIST_SYSMETRIC_SUMMARY 是在WRH$_SYSMETRIC_SUMMARY表上构建的。
一. AWR使用
SQL>@?/rdbms/admin/awrrpt.sql
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'
输入 report_type 的值:
Type Specified: html
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the mostrecent
(n) days of snapshots being listed. Pressingwithout
specifying a number lists all completed snapshots.
输入 num_days 的值: 1
Listing the last day's Completed Snapshots
Snap
Instance DBName Snap Id SnapStarted Level
------------ ------------ --------- ------------------ -----
orcl10g ORCL10G 142 03 7月 200908:11 1
143 03 7月 200909:00 1
144 03 7月 200910:00 1
145 03 7月 200911:00 1
146 03 7月 200912:01 1
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
输入 begin_snap 的值: 142
Begin Snapshot Id specified: 142
输入 end_snap 的值: 146
End Snapshot Id specified:146
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name isawrrpt_1_142_146.html. To use this name,
press to continue, otherwise enter an alternative.
输入 report_name 的值: D:\awrrpt_1_142_146.html
Report written to D:\awrrpt_1_142_146.html
二 AWR 操作
1.查看当前的AWR保存策略
SQL> col SNAP_INTERVAL format a20
SQL> col RETENTION format a20
SQL> select * from dba_hist_wr_control;
Oracle Database 10g 提供了一个显著改进的工具:自动工作负载信息库 (AWR:Automatic WorkloadRepository)。Oracle 建议用户用这个取代 Statspack。
AWR 实质上是一个 Oracle 的内置工具,它采集与性能相关的统计数据,并从那些统计数据中导出性能量度,以跟踪潜在的问题。与Statspack 不同,快照由一个称为 MMON 的新的后台进程及其从进程自动地每小时采集一次。
为了节省空间,采集的数据在 7 天后自动清除。快照频率和保留时间都可以由用户修改。
它产生两种类型的输出:文本格式(类似于 Statspack 报表的文本格式但来自于 AWR 信息库)
和默认的 HTML 格式(拥有到部分和子部分的所有超链接),从而提供了非常用户友好的报表。
AWR 使用几个表来存储采集的统计数据,所有的表都存储在新的名称为 SYSAUX 的特定表空间中的 SYS 模式下,并且以WRM$_* 和 WRH$_* 的格式命名。
前一种类型存储元数据信息(如检查的数据库和采集的快照),后一种类型保存实际采集的统计数据。
H 代表“历史数据 (historical)”而 M 代表“元数据 (metadata)”。
在这些表上构建了几种带前缀 DBA_HIST_ 的视图,这些视图可以用来编写您自己的性能诊断工具。视图的名称直接与表相关;
例如,视图 DBA_HIST_SYSMETRIC_SUMMARY 是在WRH$_SYSMETRIC_SUMMARY表上构建的。
一. AWR使用
SQL>@?/rdbms/admin/awrrpt.sql
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'
输入 report_type 的值:
Type Specified:
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the mostrecent
(n) days of snapshots being listed.
specifying a number lists all completed snapshots.
输入 num_days 的值:
Listing the last day's Completed Snapshots
Instance
------------ ------------ --------- ------------------ -----
orcl10g
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
输入 begin_snap 的值:
Begin Snapshot Id specified: 142
输入 end_snap 的值:
End
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name isawrrpt_1_142_146.html.
press to continue, otherwise enter an alternative.
输入 report_name 的值:
Report written to D:\awrrpt_1_142_146.html
二 AWR 操作
1.查看当前的AWR保存策略
SQL> col SNAP_INTERVAL format a20
SQL> col RETENTION format a20
SQL> select * from dba_hist_wr_control;