2009年10月14日 星期三

Transfer table statistic

--create temp table storing statistic
execute DBMS_STATS.create_stat_table('goex_admin','OLD_STATS');

--script to export table statistic to temp table above
select 'exec dbms_stats.export_table_stats('||chr(39)||owner||chr(39)||','||chr(39)||table_name||chr(39)||',null,'||chr(39)||'OLD_STATS'
||chr(39)||',null,true,'||chr(39)||'GOEX_ADMIN'||chr(39)||');'
from dba_tables where owner ='GOEX_ADMIN'

--script to import table statistic to temp table above
select 'exec dbms_stats.import_table_stats('||chr(39)||owner||chr(39)||','||chr(39)||table_name||chr(39)||',null,'||chr(
39)||'OLD_STATS'||chr(39)||',null,true,'||chr(39)||'GOEX_ADMIN'||chr(39)||');'
from dba_tables where owner ='GOEX_ADMIN'

http://blogs.oracle.com/AlejandroVargas/gems/HowtoExportandImportStatisti.pdf

沒有留言:

張貼留言