Oracle 10g 下新增了一个性能采样工具,AWR(Automatic Workload Repository),它比statspack收集的信息更多,使用起来更方便。AWR由运行在Oracle的后台进程自动、定期收集数据库的性能数据,并将数据保存起来,每一个小时,AWR都会生成一次性能数据快照,不需要认为干预,我们要做的就是使用这些信息,生成一个AWR的性能分析报告。
[oracle@linux db_1]$ sqlplus / as sysdba @?/rdbms/admin/awrrpt.sql
SQL*Plus: Release 10.2.0.4.0 - Production on 星期五 11月 4 10:46:22 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
1290103567 ORCL 1 orcl
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 的值: html --这里是生成html格式的awr报告。
Type Specified: html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------ ------------ ------------
* 1290103567 1 ORCL orcl linux
Using 1290103567 for database Id
Using 1 for instance number
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed. Pressing <return> without
specifying a number lists all completed snapshots.
输入 num_days 的值: 1 --显示最近1天的性能收集信息。
Listing the last day's Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level
------------ ------------ --------- ------------------ -----
orcl ORCL 13 07 10月 2011 12:07 1
14 07 10月 2011 13:00 1
15 07 10月 2011 14:01 1
16 07 10月 2011 15:00 1
17 07 10月 2011 16:00 1
18 07 10月 2011 17:00 1
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
输入 begin_snap 的值: 17
Begin Snapshot Id specified: 17 --开始快照号是17。
输入 end_snap 的值: 18
End Snapshot Id specified: 18 --结束快照号是18。
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_17_18.html. To use this name,
press <return> to continue, otherwise enter an alternative.
输入 report_name 的值: /u01/app/oracle/awr.html --生成awr报告的路径和名字。
using ...
... ...
... ...
... ...
Report written to /u01/app/oracle/awrr.html