文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

修改AWR收集时间间隔和手动创建或删除AWR收集

2024-04-02 19:55

关注


--默认的AWR是每小时执行一次,并且保留8天
SQL> select * from dba_hist_wr_control;

      DBID SNAP_INTERVAL                                                               RETENTION                                                                   TOPNSQL        CON_ID
---------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- ---------- ----------
2478546149 +00000 01:00:00.0                                                           +00008 00:00:00.0                                                           DEFAULT             0


可以通过dbms_workload_repository.modify_snapshot_settings来修改收集的时间间隙,和AWR报告的保留时间。如果收集时间间隔参数设置为0会停止所有统计数据的收集。
例子:修改AWR每15分钟收集一次,快照数据保留时间设置为20160分钟(14天)
exec dbms_workload_repository.modify_snapshot_settings(retention=>20160,interval=>15);


--可以查询出已经修改完毕。AWR每15分钟收集一次,快照数据保留14天。
SQL>  select * from dba_hist_wr_control;

      DBID SNAP_INTERVAL                                                               RETENTION                                                                   TOPNSQL        CON_ID
---------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- ---------- ----------
2478546149 +00000 00:15:00.0                                                           +00014 00:00:00.0                                                           DEFAULT             0




可以手动创建AWR快照
exec dbms_workload_repository.create_snapshot;


删除AWR快照
exec dbms_workload_repository.drop_snapshot_range(low_snap_id=>300,high_snap_id=>301);




--查看AWR所有快照
SQL>  select SNAP_ID,INSTANCE_NUMBER,BEGIN_INTERVAL_TIME,END_INTERVAL_TIME,SNAP_LEVEL from  dba_hist_snapshot order by 1;

   SNAP_ID INSTANCE_NUMBER BEGIN_INTERVAL_TIME                                                         END_INTERVAL_TIME                                                           SNAP_LEVEL
---------- --------------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- ----------
       302               2 27-OCT-15 04.20.07.131 PM                                                   27-OCT-15 05.00.16.054 PM                                                            1
       302               1 27-OCT-15 04.20.06.956 PM                                                   27-OCT-15 05.00.15.862 PM                                                            1
       303               2 27-OCT-15 05.00.16.054 PM                                                   27-OCT-15 06.00.29.251 PM                                                            1
       303               1 27-OCT-15 05.00.15.862 PM                                                   27-OCT-15 06.00.27.468 PM                                                            1
       304               1 27-OCT-15 06.00.27.468 PM                                                   27-OCT-15 07.00.12.771 PM                                                            1
       304               2 27-OCT-15 06.00.29.251 PM                                                   27-OCT-15 07.00.12.570 PM                                                            1
       305               1 27-OCT-15 07.00.12.771 PM                                                   27-OCT-15 08.00.21.897 PM                                                            1

   SNAP_ID INSTANCE_NUMBER BEGIN_INTERVAL_TIME                                                         END_INTERVAL_TIME                                                           SNAP_LEVEL
---------- --------------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- ----------
       305               2 27-OCT-15 07.00.12.570 PM                                                   27-OCT-15 08.00.21.743 PM                                                            1
       306               1 27-OCT-15 08.00.21.897 PM                                                   27-OCT-15 09.00.02.813 PM                                                            1
       306               2 27-OCT-15 08.00.21.743 PM                                                   27-OCT-15 09.00.02.923 PM                                                            1
       307               1 27-OCT-15 09.00.02.813 PM                                                   27-OCT-15 10.00.11.459 PM                                                            1
       307               2 27-OCT-15 09.00.02.923 PM                                                   27-OCT-15 10.00.12.006 PM                                                            1
       308               1 27-OCT-15 10.00.11.459 PM                                                   27-OCT-15 11.00.50.885 PM                                                            1
       308               2 27-OCT-15 10.00.12.006 PM                                                   27-OCT-15 11.00.49.493 PM                                                            1
       309               1 27-OCT-15 11.00.50.885 PM                                                   28-OCT-15 12.14.20.256 AM                                                            1
       309               2 27-OCT-15 11.00.49.493 PM                                                   28-OCT-15 12.00.57.972 AM                                                            1
       310               2 28-OCT-15 12.00.57.972 AM                                                   28-OCT-15 01.00.06.613 AM                                                            1
       311               1 28-OCT-15 01.11.44.978 AM                                                   28-OCT-15 02.00.40.285 AM                                                            1

   SNAP_ID INSTANCE_NUMBER BEGIN_INTERVAL_TIME                                                         END_INTERVAL_TIME                                                           SNAP_LEVEL
---------- --------------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- ----------
       311               2 28-OCT-15 01.00.06.613 AM                                                   28-OCT-15 02.16.06.729 AM                                                            1
       312               2 28-OCT-15 02.16.06.729 AM                                                   28-OCT-15 03.00.06.136 AM                                                            1
       312               1 28-OCT-15 02.00.40.285 AM                                                   28-OCT-15 03.00.06.072 AM                                                            1
       313               2 28-OCT-15 03.00.06.136 AM                                                   28-OCT-15 04.00.15.598 AM                                                            1
       313               1 28-OCT-15 03.00.06.072 AM                                                   28-OCT-15 04.00.15.535 AM                                                            1
       314               1 28-OCT-15 04.00.15.535 AM                                                   28-OCT-15 05.00.35.594 AM                                                            1
       314               2 28-OCT-15 04.00.15.598 AM                                                   28-OCT-15 05.00.35.487 AM                                                            1
       315               2 28-OCT-15 05.00.35.487 AM                                                   28-OCT-15 06.00.07.814 AM                                                            1
       315               1 28-OCT-15 05.00.35.594 AM                                                   28-OCT-15 06.00.07.743 AM                                                            1
       316               2 28-OCT-15 06.00.07.814 AM                                                   28-OCT-15 07.00.17.015 AM                                                            1
       316               1 28-OCT-15 06.00.07.743 AM                                                   28-OCT-15 07.00.16.955 AM                                                            1



--创建基线
SQL> exec dbms_workload_repository.create_baseline(start_snap_id => 309, end_snap_id => 314, baseline_name => 'EMO BASELINE');

PL/SQL procedure successfully completed.


SQL> select  BASELINE_NAME,BASELINE_TYPE,BASELINE_ID,START_SNAP_ID,END_SNAP_ID  from dba_hist_baseline;

BASELINE_NAME   BASELINE_TYPE BASELINE_ID START_SNAP_ID END_SNAP_ID
--------------- ------------- ----------- ------------- -----------
EMO BASELINE    STATIC                  2           309         314
SYSTEM_MOVING_W MOVING_WINDOW           0           300         343
INDOW

--删除基线
SQL>  exec dbms_workload_repository.drop_baseline(baseline_name=>'EMO BASELINE',Cascade=>FALSE);
注意:如果参数Cascade=>true,就会删除所有相关的快照。否则,AWR自动进程自动清除这些快照,默认是FALSE。

PL/SQL procedure successfully completed.

SQL> select SNAP_ID ,INSTANCE_NUMBER,BEGIN_INTERVAL_TIME,END_INTERVAL_TIME from dba_hist_snapshot order by 1;

   SNAP_ID INSTANCE_NUMBER BEGIN_INTERVAL_TIME                                                         END_INTERVAL_TIME
---------- --------------- --------------------------------------------------------------------------- ---------------------------------------------------------------------------
       300               2 21-OCT-15 03.00.25.000 PM                                                   21-OCT-15 03.12.07.602 PM
       300               1 21-OCT-15 03.03.08.000 PM                                                   21-OCT-15 03.12.07.787 PM
       301               1 27-OCT-15 04.08.36.000 PM                                                   27-OCT-15 04.20.06.956 PM
       301               2 27-OCT-15 04.10.55.000 PM                                                   27-OCT-15 04.20.07.131 PM
       302               2 27-OCT-15 04.20.07.131 PM                                                   27-OCT-15 05.00.16.054 PM
       302               1 27-OCT-15 04.20.06.956 PM                                                   27-OCT-15 05.00.15.862 PM
       303               2 27-OCT-15 05.00.16.054 PM                                                   27-OCT-15 06.00.29.251 PM
       303               1 27-OCT-15 05.00.15.862 PM                                                   27-OCT-15 06.00.27.468 PM
       304               1 27-OCT-15 06.00.27.468 PM                                                   27-OCT-15 07.00.12.771 PM
       304               2 27-OCT-15 06.00.29.251 PM                                                   27-OCT-15 07.00.12.570 PM
       305               1 27-OCT-15 07.00.12.771 PM                                                   27-OCT-15 08.00.21.897 PM

   SNAP_ID INSTANCE_NUMBER BEGIN_INTERVAL_TIME                                                         END_INTERVAL_TIME
---------- --------------- --------------------------------------------------------------------------- ---------------------------------------------------------------------------
       305               2 27-OCT-15 07.00.12.570 PM                                                   27-OCT-15 08.00.21.743 PM
       306               1 27-OCT-15 08.00.21.897 PM                                                   27-OCT-15 09.00.02.813 PM
       306               2 27-OCT-15 08.00.21.743 PM                                                   27-OCT-15 09.00.02.923 PM
       307               1 27-OCT-15 09.00.02.813 PM                                                   27-OCT-15 10.00.11.459 PM
       307               2 27-OCT-15 09.00.02.923 PM                                                   27-OCT-15 10.00.12.006 PM
       308               1 27-OCT-15 10.00.11.459 PM                                                   27-OCT-15 11.00.50.885 PM
       308               2 27-OCT-15 10.00.12.006 PM                                                   27-OCT-15 11.00.49.493 PM
       309               1 27-OCT-15 11.00.50.885 PM                                                   28-OCT-15 12.14.20.256 AM
       309               2 27-OCT-15 11.00.49.493 PM                                                   28-OCT-15 12.00.57.972 AM
       310               2 28-OCT-15 12.00.57.972 AM                                                   28-OCT-15 01.00.06.613 AM
       311               1 28-OCT-15 01.11.44.978 AM                                                   28-OCT-15 02.00.40.285 AM

   SNAP_ID INSTANCE_NUMBER BEGIN_INTERVAL_TIME                                                         END_INTERVAL_TIME
---------- --------------- --------------------------------------------------------------------------- ---------------------------------------------------------------------------
       311               2 28-OCT-15 01.00.06.613 AM                                                   28-OCT-15 02.16.06.729 AM
       312               2 28-OCT-15 02.16.06.729 AM                                                   28-OCT-15 03.00.06.136 AM
       312               1 28-OCT-15 02.00.40.285 AM                                                   28-OCT-15 03.00.06.072 AM
       313               2 28-OCT-15 03.00.06.136 AM                                                   28-OCT-15 04.00.15.598 AM
       313               1 28-OCT-15 03.00.06.072 AM                                                   28-OCT-15 04.00.15.535 AM
       314               1 28-OCT-15 04.00.15.535 AM                                                   28-OCT-15 05.00.35.594 AM
       314               2 28-OCT-15 04.00.15.598 AM                                                   28-OCT-15 05.00.35.487 AM
       315               2 28-OCT-15 05.00.35.487 AM                                                   28-OCT-15 06.00.07.814 AM
       315               1 28-OCT-15 05.00.35.594 AM                                                   28-OCT-15 06.00.07.743 AM
       316               2 28-OCT-15 06.00.07.814 AM                                                   28-OCT-15 07.00.17.015 AM
       316               1 28-OCT-15 06.00.07.743 AM                                                   28-OCT-15 07.00.16.955 AM

   SNAP_ID INSTANCE_NUMBER BEGIN_INTERVAL_TIME                                                         END_INTERVAL_TIME
---------- --------------- --------------------------------------------------------------------------- ---------------------------------------------------------------------------
       317               2 28-OCT-15 07.00.17.015 AM                                                   28-OCT-15 08.00.03.044 AM
       317               1 28-OCT-15 07.00.16.955 AM                                                   28-OCT-15 08.00.03.110 AM
       318               2 28-OCT-15 08.00.03.044 AM                                                   28-OCT-15 09.00.12.153 AM
       318               1 28-OCT-15 08.00.03.110 AM                                                   28-OCT-15 09.00.12.216 AM
       319               2 28-OCT-15 09.00.12.153 AM                                                   28-OCT-15 10.00.31.063 AM
       319               1 28-OCT-15 09.00.12.216 AM                                                   28-OCT-15 10.00.31.153 AM
       320               2 28-OCT-15 10.37.05.000 AM                                                   28-OCT-15 11.00.52.462 AM
       320               1 28-OCT-15 10.34.51.000 AM                                                   28-OCT-15 11.00.52.640 AM
       321               2 28-OCT-15 11.00.52.462 AM                                                   28-OCT-15 12.00.01.420 PM
       321               1 28-OCT-15 11.00.52.640 AM                                                   28-OCT-15 12.00.01.555 PM
       322               1 28-OCT-15 02.25.56.000 PM                                                   28-OCT-15 02.35.37.639 PM




阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-数据库
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯