在做实验之前,先介绍一下什么是AWR。
AWR:全名是Automatic Workload Respository,自动工作负载信息库,是oracle 10g提供的一个显著的改进工具,AWR实质上是一个oracle的内置工具,主要用于采集与性能相关的统计数据,并从这些统计数据中导出性能量度,用以跟踪潜在的问题。
因为初接触,我们的目标放低点,先生成AWR报告,至于后续的报告分析会在以后的文档中介绍。
要生成AWR起码要有两个快照(什么是快照?这个以后会有专门的文档介绍,请稍等!)。
1、 进入$ORACLE_HOME/rdbms/admin目录,然后用sysdba身份登录sqlplus:
[oracle@rac3 admin]$ sqlplus '/ as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Tue May 7 22:22:10 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL>
2、 在sqlplus中输入@awrrpt,然后回车:
SQL> @awrrpt
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ --------------------
1341370134 ORCL 1 orcl
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Would you like an HTML report, or aplain text report?
Enter 'html' for an HTML report, or'text' for plain text
Defaults to 'html'
Enter value for report_type: html
Type Specified:
3、 输入report_type:html或者text,我们选择html
Type Specified: html
Instances in this WorkloadRepository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------------------ ------------
* 1341370134 1 ORCL orcl rac3
Using 1341370134 for database Id
Using 1 for instance number
Specify the number of days ofsnapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) willresult in the most recent
(n) days of snapshots beinglisted. Pressing <return> without
specifying a number lists allcompleted snapshots.
Enter value for num_days:
4、 选择要生成报告的日期是多少天以前的记录,输入1,则表示要生成今天0点开始到现在之内的某个时间段的报告,输入2,则表示要生成昨天0点开始到现在的某个时间段的报告,依次类推。缺省记录是7天。这里输入2作为示例:
Enter value for num_days:2
Listing the last day's CompletedSnapshots
Snap
Instance DB Name Snap Id Snap Started Level
------------ ------------ --------------------------- -----
orcl ORCL 25 07 May 2013 03:53 1
26 07 May 201305:00 1
Specify the Begin and End SnapshotIds
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap:
5、 在这里选择开始点的快照,如上标记所示,我们只有两个快照所以就选25作为开始点
Enter value for begin_snap: 25
Begin Snapshot Id specified: 25
Enter value for end_snap:
6、 在这里选择结束点的快照,如上标记所示,我们只有两个快照所以就选26作为结束点
Enter value for end_snap: 26
End Snapshot Id specified: 26
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name isawrrpt_1_25_26.html. To use this name,
press <return> to continue,otherwise enter an alternative.
Enter value for report_name:
7、 这里输入报告名称,这只是一个小测试,随便起了名字awrrpt_test.html,然后回车,就会在当前路径下生成报告文件。
[oracle@rac3admin]$ ls *.html
awrrpt_test.html
剩下的就可以通过工具将文件下载下来了。
感谢地址:http://wenku.baidu.com/view/83b141c44028915f804dc297.html