今天接到朋友数据库一个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
启用oracle 11g自动收集统计信息
时间: 2024-10-26 03:33:10