本帖最后由 tacsoft 于 2010-10-17 21:12 编辑
生成AWR报告
Oracle提供一个脚本awrrpt.sql,位置在$ORACLE_HOME/rdbms/admin目录下,这个脚本用来生成AWR报告。
下面实例是输出一份AWR报告:
1) 以DBA权限登录Oracle数据库运行awrrpt.sql脚本
[oracle@tacsoft ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 11 17:52:57 2010
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Tacsoft_SQL> conn /as sysdba
Connected.
Tacsoft_SQL> @/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/awrrpt.sql
(运行脚本)
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
1252178413 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'
Enter value for report_type: html
Type Specified: html
(选择输出格式)
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------ ------------ ------------
* 1252178413 1 ORCL orcl tacsoft
Using 1252178413 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.
Enter value for num_days: 3
(查看快照的天数 默认保存7天的快照信息,这里我们选择3天)
Listing the last 3 days of Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level
------------ ------------ --------- ------------------ -----
orcl ORCL 40 09 Aug 2010 17:37 1
41 09 Aug 2010 19:00 1
42 09 Aug 2010 20:00 1
43 10 Aug 2010 16:42 1
44 10 Aug 2010 18:00 1
45 10 Aug 2010 19:00 2
46 11 Aug 2010 14:30 1
47 11 Aug 2010 17:44 1
(注意这些Snap Id是后面输入需要用到的,超出这个范围,系统将报错)
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 41
Begin Snapshot Id specified: 41
(输入开始快照ID)
Enter value for end_snap: 42
End Snapshot Id specified: 42
(输入结束快照ID)
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_41_42.html. To use this name,
press <return> to continue, otherwise enter an alternative.
Enter value for report_name: test_report
(给输出报告起名,回车后开始输出报告)
Using the report name test_report
<html><head><title>AWR Report for DB: ORCL, Inst: orcl, Snaps: 41-42</title>
<style type="text/css">
body.awr {font:bold 10pt Arial,Helvetica,Geneva,sans-serif;color:black; background:White;}
pre.awr {font:8pt Courier;color:black; background:White;}
……..
……..
………
End of Report
</body></html>
Report written to test_report
报告生成完毕
该报告是HTML格式的,因此使用IE就可以方便的查看,报告中的项目和内容需要熟悉Oracle的术语和文档,术语是Oracle通用术语。 |