Oracle----Statistics Migration

1. Perform a stats operation

BEGIN
   DBMS_STATS.GATHER_SCHEMA_STATS('SCOTT', 10);
END;
/

2. Create a statistics entity table

BEGIN
   DBMS_STATS.CREATE_STAT_TABLE(null,'STATISTICS',null);
END;
/

3. Export statistics to entity table

BEGIN
   DBMS_STATS.EXPORT_SCHEMA_STATS ('SCOTT', 'STATISTICS', NULL, NULL);
END;
/

4. Export entity table

exp scott/tiger tables=STATISTICS file=statistics.dmp log=statistics_export.log
5. Import entity table
imp scott/tiger tables=STATISTICS file=statistics.dmp log=statistics_import.log ignore=y

6. Update your username

update statistics set c5='TEST

7. Import entity table to statistics

begin
DBMS_STATS.import_schema_stats('SCOTT','STATISTICS',NULL, NULL, NULL);
end;
/

8. View Statistics

select user_tables.num_rows,user_tables.last_analyzed,user_tables.* from user_tables;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324972746&siteId=291194637