1) Export MYTAB stats.
2) Do your thing (Create, Delete, Rename, ...)
3) Import MYTAB stats
Main Topics
Browse All TopicsIs it possible to copy statistics between tables, specifically large partitioned tables?
We are using Oracle 10g (10.2.0.4.0) which has much of the functionality included in the first release of 11g (as I've just found out).
We have a situation where large partitioned summary tables are rebuilt every night from source data using the following sequence of events:
create NEW_MYTAB table from source data
delete OLD_MYTAB table
rename MYTAB table to OLD_MYTAB table
rename NEW_MYTAB table to MYTAB
The result is that the newly created table is now called MYTAB, but it doesn't have any statistics on it. Currently it takes about an hour to gather stats (partition and global) on this table. I would like to copy the statistics from the OLD_MYTAB table to the MYTAB table as these will be accurate enough.
One thought is to export the OLD_MYTAB statistics into a stats table, update the "C1" column, which appears to be the table name (from OLD_MYTAB to MYTAB), and then import the statistics into the MYTAB table.
I was wondering if there was a better way of doing this.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Oracle Data Pump can export statistics only but there are some complaints:
Importing statistics takes unreasonable amounts of time. We had to export and import one schema. Collecting statistics on this schema takes around 5 minutes. Importing the statistics using Data Pump took over 20 minutes. Oracles documentation fails to mention this little bit of information. I really hope this issue is fixed in 11g.
Work around: import with exclude=statistics flag and collect statistics later.
So a workaround is to copy the statistics to a stattab using dbms_stats, export that table, import the table in the other database, and use dbms_stats to import the statistics in the other dictionary.
create stats table to hold exported stats data.
EXEC DBMS_STATS.create_stat_tab
export stats to stats table
EXEC DBMS_STATS.export_schema_s
transfer the stats table ST_TABLE to destinate location using method of choice, like exp/imp, create tabel as select ..., sqlplus copy etc.
import the stats into schema
EXEC DBMS_STATS.import_schema_s
Business Accounts
Answer for Membership
by: MikeOM_DBAPosted on 2009-05-20 at 11:17:14ID: 24434675
Yes, check out the DBMS_STATS package.