有时候数据库中为安装EM,无法图形化生成AWR报告,此时需要手工生成AWR报告,Oracle提供了以个sql,可以手工生成AWR报告,首先创建生成报告的目录,这里为/home/oracle/AWR$ mkdir AWR
$ cd AWR
$ pwd
/home/oracle/AWR进入sqlplus[oracle@ocp ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 30 02:41:04 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options执行脚本,?代表$ORACLE_HOME,@表示执行sql,默认提供两种报表格式,html和txt,默认为html格式@?/rdbms/admin/awrrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
1425858850 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选择从系统中抽取的报告的时间段,一般设7天就可以了,ORACLE会把七天内的报告都显示在屏幕上Enter value for num_days: 7
Listing the last 7 days of Completed Snapshots输入开始的snap id和结束的snap id,表示截取报告的时间段Instance DB Name Snap Id Snap Started Level
------------ ------------ --------- ------------------ -----
orcl ORCL 81 29 Dec 2015 13:33 1
82 29 Dec 2015 15:00 1
83 29 Dec 2015 16:00 1
84 29 Dec 2015 17:00 1
85 29 Dec 2015 18:00 1
86 29 Dec 2015 19:00 1
87 29 Dec 2015 20:00 1
88 29 Dec 2015 21:00 1
89 29 Dec 2015 22:00 1
90 29 Dec 2015 23:00 1
91 30 Dec 2015 00:00 1
92 30 Dec 2015 01:00 1
93 30 Dec 2015 02:00 1
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 83
Begin Snapshot Id specified: 83
Enter value for end_snap: 93
End Snapshot Id specified: 93指定报告名称,如果不指定,直接回车,系统会按照屏幕提示名称生成报告名Report written to awrrpt_1_83_93.html下载到本地后查看就可以了更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12本文永久更新链接地址