1.创建存放统计信息的表:
exec DBMS_STATS.CREATE_STAT_TABLE (ownname=>'GYJ', stattab=>'STAT_TAB',tblspace=>'STAT_TP1');
2.导出备份统计信息:
exec dbms_stats.export_table_stats(ownname=>'GYJ',tabname=>'LOG_PREPAY_INFO',stattab=>'STAT_TAB');
3.比如分析过后,发现有问题:
analyze table LOG_PREPAY_INFO compute statistics
for table
for all indexes
for all indexed columns;
4.马上删除:
analyze table LOG_PREPAY_INFO delete statistics;
5.马上导入刚才备份的信息:
exec dbms_stats.import_table_stats(ownname=>'GYJ',tabname=>'LOG_PREPAY_INFO',stattab=>'STAT_TAB');
6.其中列上面的柱状图信息,需要这样删除:
DBMS_STATS.DELETE_COLUMN_STATS (
ownname VARCHAR2,
tabname VARCHAR2,
colname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
stattab VARCHAR2 DEFAULT NULL,
statid VARCHAR2 DEFAULT NULL,
cascade_parts BOOLEAN DEFAULT TRUE,
statown VARCHAR2 DEFAULT NULL,
no_invalidate BOOLEAN DEFAULT FALSE);
比如:
exec DBMS_STATS.DELETE_COLUMN_STATS(ownname=>'HR',tabname=>'EMPLOYEES',colname=>'STATUS');
查看本栏目更多精彩内容:http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/