Oracle-AWR管理包DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS
- 概述
- MODIFY_SNAPSHOT_SETTINGS Procedures
概述
官方說明:DBMS_WORKLOAD_REPOSITORY
Overview of the Automatic Workload Repository
AWR機制:通過對系統整體動態采樣收集快照信息,存儲在SYSAUX表空間,,MMON進程實施,快照分析后寫入DBA_HIST_%開頭的數據字典。
select table_name from dictionary where table_name like 'DBA_HIST_%';DBMS_WORKLOAD_REPOSITORY包管理AWR(Automatic Workload Repository),執行諸如管理快照和基線等操作。
因包中功能眾多,這里我們僅關注MODIFY_SNAPSHOT_SETTINGS
MODIFY_SNAPSHOT_SETTINGS Procedures
默認快照間隔1小時,10g保存7天,11g保存8天
可以通過dbms_workload_repository.MODIFY_SNAPSHOT_SETTINGS存過來調整AWR快照的相關參數
我們來看下Oralce對這段存過標注的注釋 ,說明均在注釋里,請仔細閱讀
-- -- modify_snapshot_settings() -- Procedure to adjust the settings of the snapshot collection. -- -- Input arguments: -- retention - new retention time (in minutes). The -- specified value must be in the range: -- MIN_RETENTION (1 day) to -- MAX_RETENTION (100 years) -- -- If ZERO is specified, snapshots will be -- retained forever. A large system-defined -- value will be used as the retention setting. -- -- If NULL is specified, the old value for -- retention is preserved. -- -- *************** -- NOTE: The retention setting must be -- greater than or equal to the window -- size of the 'SYSTEM_MOVING_WINDOW' -- baseline. If the retention needs -- to be less than the window size, -- the 'modify_baseline_window_size' -- routine can be used to adjust the -- window size. -- *************** -- -- interval - the interval between each snapshot, in -- units of minutes. The specified value -- must be in the range: -- MIN_INTERVAL (10 minutes) to -- MAX_INTERVAL (100 years) -- -- If ZERO is specified, automatic and manual -- snapshots will be disabled. A large -- system-defined value will be used as the -- interval setting. -- -- If NULL is specified, the -- current value is preserved. -- -- topnsql (NUMBER) - Top N SQL size. The number of Top SQL -- to flush for each SQL criteria -- (Elapsed Time, CPU Time, Parse Calls, -- Shareable Memory, Version Count). -- -- The value for this setting will be not -- be affected by the statistics/flush level -- and will override the system default -- behavior for the AWR SQL collection. The -- setting will have a minimum value of 30 -- and a maximum value of 50000. -- -- IF NULL is specified, the -- current value is preserved. -- -- topnsql (VARCHAR2) - Users are allowed to specify the following -- values: ('DEFAULT', 'MAXIMUM', 'N') -- -- Specifying 'DEFAULT' will revert the system -- back to the default behavior of Top 30 for -- level TYPICAL and Top 100 for level ALL. -- -- Specifying 'MAXIMUM' will cause the system -- to capture the complete set of SQL in the -- cursor cache. Specifying the number 'N' is -- equivalent to setting the Top N SQL with -- the NUMBER type. -- -- Specifying 'N' will cause the system -- to flush the Top N SQL for each criteria. -- The 'N' string is converted into the number -- for Top N SQL. -- -- dbid - database identifier for the database to -- adjust setting. If NULL is specified, the -- local dbid will be used. -- -- For example, the following statement can be used to set the -- Retention and Interval to their minimum settings: -- -- dbms_workload_repository.modify_snapshot_settings -- (retention => DBMS_WORKLOAD_REPOSITORY.MIN_RETENTION -- interval => DBMS_WORKLOAD_REPOSITORY.MIN_INTERVAL) -- -- The following statement can be used to set the Retention to -- 8 days and the Interval to 60 minutes and the Top N SQL to -- the default setting: -- -- dbms_workload_repository.modify_snapshot_settings -- (retention => 11520, interval => 60, topnsql => 'DEFAULT'); -- -- The following statement can be used to set the Top N SQL -- setting to 200: -- dbms_workload_repository.modify_snapshot_settings -- (topnsql => 200); --存過定義如下
PROCEDURE modify_snapshot_settings(retention IN NUMBER DEFAULT NULL,interval IN NUMBER DEFAULT NULL,topnsql IN NUMBER DEFAULT NULL,dbid IN NUMBER DEFAULT NULL);PROCEDURE modify_snapshot_settings(retention IN NUMBER DEFAULT NULL,interval IN NUMBER DEFAULT NULL,topnsql IN VARCHAR2,dbid IN NUMBER DEFAULT NULL);如何修改默認的參數值呢?
This example changes the interval setting to one hour and the retention setting to two weeks for the local database:
EXECUTE DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS(interval => 60,retention => 20160);重新查詢 DBA_HIST_WR_CONTROL 可以發現新的規則已經生效。
AWR參數存放的表 DBA_HIST_WR_CONTROL
snapshot的信息存放在DBA_HIST_SNAPSHOT
總結
以上是生活随笔為你收集整理的Oracle-AWR管理包DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Oracle-awrddrpt.sql比
- 下一篇: MyBatis-07MyBatis注解方