Friday, October 6, 2017

Migrate oracle database statistics

Steps to Export Import table database statistics for specific table using dbms_stat

1. Create the stats table in source instance where you have to export. Run as SYSTEM user

      exec dbms_stats.create_stat_table('XX','STATS_EBSP');

2. Export the stats for table (AP_INV_TBL) in the stats table in source instance:

exec dbms_stats.export_table_stats('XX','AP_INV_TBL',NULL,'STATS_EBSP',NULL,TRUE,'AP');

3.  Export the stats table in source instance using export utility:

exp system/*** tables='XX.STATS_EBSP' file=stat_ebsp.dmp log=expstat_ebsp.log

4.  Import the stats table into the target instance using import utility

imp system/***  file=stat_ebsp.dmp fromuser=XX touser=XX ignore=y

5. Import the stats for the table into target instance:

exec dbms_stats.import_table_stats('XX', 'AP_INV_TBL',NULL,'STATS_EBSP',NULL,TRUE,'AP');

No comments:

Post a Comment

Oracle database performance notes

Master Note: Database Performance Overview (Doc ID 402983.1) SQL Tuning Health-Check Script (SQLHC) (Doc ID 1366133.1) Achieving Optimal Per...