1.AWR默認的采樣間隔和歷史快照保留時間 默認是保留七天,采集間隔是1小時,這個信息可以從DBA_HIST_WR_CONTROL視圖中獲得。 sys@ora10g> col SNAP_INTERVAL for a20 sys@ora10g> col RETENTION for a20 sys@ora10g> select * from dba_hist_wr_control;
3.修改AWR默認的采樣間隔和歷史快照保留時間之SQL方法 萬變不離其宗,任何能從界面上進行修改的內(nèi)容都可以通過SQL調(diào)整的方法來完成。 我們即將使用到的是DBMS_WORKLOAD_REPOSITORY包中的MODIFY_SNAPSHOT_SETTINGS存儲過程。 該存儲過程的簡單描述信息如下。 sec@ora10g> desc DBMS_WORKLOAD_REPOSITORY …… …… PROCEDURE MODIFY_SNAPSHOT_SETTINGS Argument Name Type In/Out Default? ------------------------------ --------------- ------ -------- RETENTION NUMBER IN DEFAULT INTERVAL NUMBER IN DEFAULT TOPNSQL VARCHAR2 IN DBID NUMBER IN DEFAULT
BEGIN * ERROR at line 1: ORA-13510: invalid RETENTION 720, must be in the range (1440, 52560000) ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 85 ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 133 ORA-06512: at line 2
sys@ora10g> BEGIN 2 DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS( 3 interval => 60, 4 retention => 36501*24*60); 5 END; 6 / BEGIN * ERROR at line 1: ORA-13510: invalid RETENTION 52561440, must be in the range (1440, 52560000) ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 85 ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 133 ORA-06512: at line 2
2)驗證INTERVAL參數(shù)的取值范圍 sys@ora10g> BEGIN 2 DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS( 3 interval => 9, 4 retention => 7*24*60); 5 END; 6 / BEGIN * ERROR at line 1: ORA-13511: invalid INTERVAL 9, must be in the range (10, 52560000) ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 85 ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 133 ORA-06512: at line 2