Oralce----统计信息迁移

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.更新一下用户名

update statistics set c5='TEST

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;

猜你喜欢

转载自www.cnblogs.com/ykyk1229/p/8960955.html