问题
解决方案
exec dbms_stats.gather_table_stats('SYS','TEST');
select owner,table_name,stattype_locked from dba_tab_statistics a where a.stattype_locked in ('ALL','DATA','CACHE') and table_name='TEST';exec dbms_stats.unlock_table_stats(ownname => 'SYS',tabname => 'TEST');exec dbms_stats.gather_table_stats('SYS','TEST');
exec dbms_stats.lock_table_stats(ownname => 'SYS',tabname => 'TEST');
BEGINDBMS_STATS.GATHER_TABLE_STATS(ownname => 'BISTAT',tabname => 'MID_CB_NEWPOLICY_DIM_CAR',estimate_percent => 30, -----------(1-5G 50% 大于5G 30%)method_opt => 'for all columns size repeat|auto|1|skewonly', ---size后面是生成直方图的时候选择的bucket个数 ---1表示对所有列不收集直方图 --auto 10g以后的默认选项 --repeat:收集当前已经有直方图的列 --skewonly 只在数据不均匀分布的列上收集直方图。no_invalidate => FALSE, ----false表示将统计量对象相关的所有cursor全部失效,默认为autodegree => 4,granularity => 'ALL', -----目前已知用于收集分区表统计信息cascade => TRUE); ----收集索引的信息,默认为false
END;
/
select owner,object_name ,object_type from dba_objects where object_name like 'TEST';