select * from dba_hist_wr_control; DBID SNAP_INTERVAL &nbs..."/>
您好,登錄后才能下訂單哦!
--默認(rèn)的AWR是每小時(shí)執(zhí)行一次,并且保留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來修改收集的時(shí)間間隙,和AWR報(bào)告的保留時(shí)間。如果收集時(shí)間間隔參數(shù)設(shè)置為0會(huì)停止所有統(tǒng)計(jì)數(shù)據(jù)的收集。
例子:修改AWR每15分鐘收集一次,快照數(shù)據(jù)保留時(shí)間設(shè)置為20160分鐘(14天)
exec dbms_workload_repository.modify_snapshot_settings(retention=>20160,interval=>15);
--可以查詢出已經(jīng)修改完畢。AWR每15分鐘收集一次,快照數(shù)據(jù)保留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
可以手動(dòng)創(chuàng)建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
--創(chuàng)建基線
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);
注意:如果參數(shù)Cascade=>true,就會(huì)刪除所有相關(guān)的快照。否則,AWR自動(dòng)進(jìn)程自動(dòng)清除這些快照,默認(rèn)是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
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。