首页 > 数据库 > Oracle > 上周生产环境AWR报告生成步骤
1、进入awrrpt.sql所在路径
$ cd $ORACLE_HOME/rdbms/admin
2、sys登录
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Nov 9 15:53:49 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
3、执行awrrpt.sql脚本
[@more@]SQL> @awrrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
2751070068 ORCL 1 orcl
4、输入报表默认格式为html(有html和txt两种格式,不输入则默认html)
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
------------ -------- ------------ ------------ ------------
* 2751070068 1 ORCL orcl p750b
2751070068 1 ORCL orcl1 p750a
* 2751070068 1 ORCL orcl p750a
Using 2751070068 for database Id
Using 1 for instance number
5、输入要查询几天的快照
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
specifying a number lists all completed snapshots.
Enter value for num_days: 1
Listing the last day's Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level
------------ ------------ --------- ------------------ -----
orcl ORCL 20849 09 Nov 2012 00:00 1
20850 09 Nov 2012 00:15 1
20851 09 Nov 2012 00:30 1
20852 09 Nov 2012 00:45 1
20853 09 Nov 2012 01:00 1
-----<此处省略快照>-----
20899 09 Nov 2012 12:30 1
20900 09 Nov 2012 12:45 1
20901 09 Nov 2012 13:01 1
20902 09 Nov 2012 13:15 1
20903 09 Nov 2012 13:30 1
20904 09 Nov 2012 13:45 1
Snap
Instance DB Name Snap Id Snap Started Level
------------ ------------ --------- ------------------ -----
orcl ORCL 20905 09 Nov 2012 14:00 1
20906 09 Nov 2012 14:15 1
20907 09 Nov 2012 14:30 1
20908 09 Nov 2012 14:46 1
20909 09 Nov 2012 15:00 1
20910 09 Nov 2012 15:15 1
20911 09 Nov 2012 15:30 1
20912 09 Nov 2012 15:45 1
6、输入开始监控的快照ID
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 20905
Begin Snapshot Id specified: 20905
7、输入结束监控的快照ID
Enter value for end_snap: 20909
End Snapshot Id specified: 20909
8、输入生成报表的名称,不输入则默认已快照命名
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_20905_20909.html. To use this name,
press
Enter value for report_name:
Using the report name awrrpt_1_20905_20909.html
9、以下为自动生成的html报表的代码