码迷,mamicode.com
首页 > 数据库 > 详细

ORACLE 11G 如何修改 awr 的保留期限小于8天

时间:2014-07-22 23:05:33      阅读:358      评论:0      收藏:0      [点我收藏+]

标签:style   os   数据   io   for   re   



ORACLE 11G 如何修改 awr 的保留期限小于8天

Oracle Database 11g 默认具备一个系统定义的Moving Window Baseline,该基线对应于 AWR 保留期中的所有 AWR 数据。
仅可存在一个Moving Window Baseline。
系统定义的Moving Window Baseline认大小为当前的AWR保留期,即默认为八天。

如果要增大Moving Window Baseline,首先需要相应增大AWR保留期。
AWR保留期和系统定义的Moving Window Baseline的大小是两个独立的参数。
但是AWR保留期必须大于或等于系统定义的Moving Window Baseline的大小。


-----------查看awr 的保留时间,快照间隔:

SQL> select DBID, SNAP_INTERVAL, SNAPINT_NUM, RETENTION from wrm$_wr_control;

   DBID     SNAP_INTERVAL            SNAPINT_NUM    RETENTION
---------- -------------------------------------------- -----------
4215476630 +00000 01:00:00.0           3600        +00030 00:00:00.0


SQL> select * from dba_hist_wr_control;

      DBID SNAP_INTERVAL                                                               RETENTION                                                                   TOPNSQL
---------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- ----------
4215476630 +00000 01:00:00.0                                                           +00030 00:00:00.0                                                           DEFAULT


SQL>  select dbms_stats.get_stats_history_retention from dual;

GET_STATS_HISTORY_RETENTION
---------------------------
                         31


---------直接修改awr 保留期限为7天

SQL> exec dbms_workload_repository.modify_snapshot_settings(interval=>60, retention=>10080);
BEGIN dbms_workload_repository.modify_snapshot_settings(interval=>60, retention=>10080); END;

*
ERROR at line 1:
ORA-13541: system moving window baseline size (691200) greater than retention (604800)
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 174
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 222
ORA-06512: at line 1


10080=7*24*60*60
691200=8*24*60*60  8天




------------查看当前Moving Window Baseline的值


SQL> col BASELINE_NAME for a30
SQL> select dbid, baseline_name, baseline_type, moving_window_size from dba_hist_baseline;
      DBID BASELINE_NAME                  BASELINE_TYPE MOVING_WINDOW_SIZE
---------- ------------------------------ ------------- ------------------
4215476630 SYSTEM_MOVING_WINDOW           MOVING_WINDOW                  8


既然知道了原因,解决就很方便了,Modifying the Window Size of the Default Moving Window Baseline


BEGIN
    DBMS_WORKLOAD_REPOSITORY.MODIFY_BASELINE_WINDOW_SIZE (
                   window_size => 5,
                   dbid => 4215476630);
END;
/

其中要注意:window size必须设置为一个小于或等于AWR设置的保留值。

这时就可以修改awr 快照的保留时间了:


SQL> exec dbms_workload_repository.modify_snapshot_settings(interval=>60, retention=>10080);

PL/SQL procedure successfully completed.


SQL> select * from dba_hist_wr_control;

      DBID SNAP_INTERVAL                                                               RETENTION                                                                   TOPNSQL
---------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- ----------
4215476630 +00000 01:00:00.0                                                           +00007 00:00:00.0                                                           DEFAULT

ORACLE 11G 如何修改 awr 的保留期限小于8天,码迷,mamicode.com

ORACLE 11G 如何修改 awr 的保留期限小于8天

标签:style   os   数据   io   for   re   

原文地址:http://blog.csdn.net/lixora/article/details/24741765

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!