dbms_stats export import optimizer statistics

Examples of syntax to export/import dbms_stats:

exec dbms_stats.create_stat_table ( ownname => user , stattab => 'temp_stats' ) ;
exec dbms_stats.export_table_stats ( ownname => user , stattab => 'temp_stats', tabname => 'mytable', statid => 'Taken_7Apr2010') ;
exec dbms_stats.import_table_stats ( ownname => user , stattab => 'temp_stats', tabname => 'adm_fact' )

Similarly for schema:

exec DBMS_STATS.EXPORT_SCHEMA_STATS ( ownname => 'myowner' , stattab => 'temp_stats', statown => user )

A bug in 10g prevents spaces being passed into the “statid” variable, hence the underscores in the above example.

Leave a Reply