一、 awr使用 sqlgt;@?/rdbms/admin/awrrpt.sql specify the report type ~~~~~~~~~~~~~~~~~~~~~~~ would you like an html re
一、 awr使用
sql>@?/rdbms/admin/awrrpt.sql
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 的值:
type specified: html
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.
输入 num_days 的值: 1
listing the last day's completed snapshots
snap
instance db name snap id snap started level
------------ ------------ --------- ------------------ -----
orcl10g orcl10g 142 03 7月 2009 08:11 1
143 03 7月 2009 09:00 1
144 03 7月 2009 10:00 1
145 03 7月 2009 11:00 1
146 03 7月 2009 12:01 1
specify the begin and end snapshot ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
输入 begin_snap 的值: 142
begin snapshot id specified: 142
输入 end_snap 的值: 146
end snapshot id specified: 146
specify the report name
~~~~~~~~~~~~~~~~~~~~~~~
the default report file name is awrrpt_1_142_146.html. to use this name,
press to continue, otherwise enter an alternative.
输入 report_name 的值: /home/oracle/awrrpt_1_142_146.html
report written to /home/oracle/awrrpt_1_142_146.html
二、awr管理
(1)关闭awr:
sql> exec dbms_workload_repository.modify_snapshot_settings(interval=>0);
说明:把interval设为0则已经关闭awr功能。
验证:
sql> select * from dba_hist_wr_control;
dbid snap_interval retention topnsql
---------- ------------------- ------------------- ----------
450641661 +40150 00:00:00.0 +00008 00:00:00.0 default
(2)打开awr:
sql> exec dbms_workload_repository.modify_snapshot_settings(interval=>30, retention=>5*24*60);
说明:收集间隔时间为30分钟一次,并且保留5天时间(单位都是分钟)
如果执行时报错:
sql> exec dbms_workload_repository.modify_snapshot_settings(interval=>30, retention=>5*24*60);
begin dbms_workload_repository.modify_snapshot_settings(interval=>30, retention=>5*24*60); end;
*
error at line 1:
ora-13541: system moving window baseline size (691200) greater than retention (432000)
ora-06512: at sys.dbms_workload_repository, line 89
ora-06512: at sys.dbms_workload_repository, line 137
ora-06512: at line 1
原因是系统设置的baseline size值(691200)大于此时设置的retention(432000),,那么此时有两种方法解决:
方法1:增大retention值,也就是增大保存天数,比如修改为:
sql> exec dbms_workload_repository.modify_snapshot_settings(interval=>30, retention=>9*24*60);
pl/sql procedure successfully completed.
验证:
sql> select * from dba_hist_wr_control;
dbid snap_interval retention topnsql
---------- ------------------- ------------------- ----------
450641661 +00000 00:30:00.0 +00009 00:00:00.0 default
(3)查看快照记录:
select * from sys.wrh$_active_session_history
