AWR报告就是查看数据库历史的各种性能参数,生成报告过程相对容易,但是查看AWR性能报告就复杂多了。
以下是生成AWR报告的过程,至于如何去看报告,这里不做介绍。
生成awr报告过程:
1、进入存放AWR报告的目录以DBA角色登录数据库:
[oracle@enmo ~]$ sqlplus / as sysdba
2、执行以下脚本:
SQL> @?/rdbms/admin/awrrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
238796283 ORA11GR2 1 OCMU
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: (回车)------直接回车跳到下一步
Type Specified: html ------默认AWR报告的格式为html (则网页格式显示,则在浏览器打开浏览报告)
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------ ------------ ------------
* 238796283 1 ORA11GR2 OCMU enmo.oracle.
com
238796283 1 ORA11GR2 ORA11GR2 oracle
Using 238796283 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 without
specifying a number lists all completed snapshots.
3、确定查看的天数:
Enter value for num_days: 10 -----选择查看天数:
提供了10天内的快照明细:
Listing the last 10 days of Completed Snapshots
...
Snap
Instance DB Name Snap Id Snap Started Level
------------ ------------ --------- ------------------ -----
OCMU ORA11GR2 127 10 Oct 2016 21:50 1
128 10 Oct 2016 23:00 1
129 11 Oct 2016 09:55 1
130 11 Oct 2016 11:00 1
131 11 Oct 2016 12:00 1
132 11 Oct 2016 13:00 1
133 11 Oct 2016 14:00 1
134 11 Oct 2016 15:00 1
135 11 Oct 2016 16:00 1
136 11 Oct 2016 17:00 1
137 11 Oct 2016 19:40 1
138 11 Oct 2016 21:00 1
139 11 Oct 2016 22:00 1
140 11 Oct 2016 23:00 1
141 12 Oct 2016 00:00 1
142 12 Oct 2016 09:40 1
143 12 Oct 2016 14:08 1
144 12 Oct 2016 15:00 1
145 12 Oct 2016 16:00 1
146 12 Oct 2016 17:00 1
147 12 Oct 2016 20:23 1
148 12 Oct 2016 21:00 1
149 12 Oct 2016 22:00 1
150 12 Oct 2016 23:00 1
151 13 Oct 2016 00:00 1
152 13 Oct 2016 09:38 1
153 13 Oct 2016 11:01 1
154 13 Oct 2016 12:00 1
155 13 Oct 2016 13:00 1
4、选择连续的设定生成报告中快照的开始与结束的ID:
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 101
Begin Snapshot Id specified: 101
Enter value for end_snap: 126
End Snapshot Id specified: 126
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_101_126.html. To use this name,
press to continue, otherwise enter an alternative.
5、填写AWR报告的文件名:
Enter value for report_name: myawrrpt
----开始生成报告:
control_files
/u01/app/oracle/fast_recovery_area/control02.ctl
control_files
/u01/app/oracle/oradata/ORA11GR2/control01.ctl
control_files
/u01/app/oracle/oradata/ORA11GR2/control03.ctl
Back to init.ora Parameters
Back to Top
Dynamic Remastering Stats
No data exists for this section of the report.
Back to Top
End of Report
Report written to myawrrpt
awr报告生成结束。接着就是查看报告的内容,直接在浏览器打开报告文件就可以浏览了。
手动生成一个快照的语句: exec dbms_workload_repository.create_snapshot();
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31392094/viewspace-2126486/
,如需转载,请注明出处,否则将追究法律责任。