1.执行统计信息操作
BEGIN
DBMS_STATS.GATHER_SCHEMA_STATS('SCOTT', 10);
END;
/
2.创建一个统计信息实体表
BEGIN
DBMS_STATS.CREATE_STAT_TABLE(null,'STATISTICS',null);
END;
/
3.统计信息导出至实体表
BEGIN
DBMS_STATS.EXPORT_SCHEMA_STATS ('SCOTT', 'STATISTICS', NULL, NULL);
END;
/
4.导出实体表
exp scott/tiger tables=STATISTICS file=statistics.dmp log=statistics_export.log
5.导入实体表
imp scott/tiger tables=STATISTICS file=statistics.dmp log=statistics_import.log ignore=y
6.更新一下用户名
7.实体表汇入至统计信息
begin
DBMS_STATS.import_schema_stats('SCOTT','STATISTICS',NULL, NULL, NULL);
end;
/
8.查看统计信息
select user_tables.num_rows,user_tables.last_analyzed,user_tables.* from user_tables;