今天接到朋友數據庫一個case,在DBCA建庫時,把自動收集統計信息的選項去掉了,數據庫運行半年沒有收集過統計信息,現在要啟用方法如下:
exec DBMS_AUTO_TASK_ADMIN.ENABLE();
exec DBMS_AUTO_TASK_ADMIN.ENABLE(client_name => 'auto optimizer stats collection',operation =>'auto optimizer stats job',window_name=> null);
exec DBMS_AUTO_TASK_ADMIN.ENABLE(client_name => 'auto optimizer stats collection',operation => NULL,window_name => NULL);
select window_name,
window_next_time,
optimizer_stats,
aa.WINDOW_ACTIVE,
aa.SEGMENT_ADVISOR,
aa.AUTOTASK_STATUS,
aa.OPTIMIZER_STATS
from dba_autotask_window_clients aa
order by window_next_time