日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

统计信息的备份

發(fā)布時間:2023/12/9 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 统计信息的备份 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

一般重新收集table 或index 都會有風(fēng)險,需要把之前的統(tǒng)計信息備份下,萬一收集后performance 沒有之前好,已經(jīng)將備份的統(tǒng)計信息導(dǎo)入快速恢復(fù)。

創(chuàng)建統(tǒng)計信息備份表

begin

dbms_stats.create_stat_table(ownname => 'SYSTEM',stattab => 'STAT_BK');

end;

/

?

生成表統(tǒng)計信息導(dǎo)出備份腳本

select 'begin dbms_stats.export_table_stats(ownname => ' || chr(39) ||

?????? b.owner || chr(39) || ',tabname =>' || chr(39) || b.table_name ||

??????chr(39) || ',stattab =>' || chr(39) || 'STAT_BK' || chr(39) ||

?????? ',statown =>' || chr(39) || 'SYSTEM' || chr(39) ||

?????? ',cascade => true); end; /'
?from dba_segments a, dba_tables b
?where a.tablespace_name IN ('DW_100M_DT')
?? and a.segment_type = 'TABLE'
?? and a.owner = b.owner
?? and a.segment_name = b.table_name;

?

begin

SYS.dbms_stats.export_table_stats(ownname => 'MESTST',tabname =>'ACTIONMAP',stattab =>'STAT_BK',cascade => true,statown=>'SYSTEM');

end;

/

?

生成索引統(tǒng)計信息導(dǎo)出備份腳本

select 'begin dbms_stats.export_index_stats(ownname => ' || chr(39) ||

?????? b.owner || chr(39) || ',indname =>' || chr(39) || b.index_name ||

?????? chr(39) || ',stattab =>' || chr(39) || 'STAT_BK' || chr(39) ||

?????? ',statown =>' || chr(39) || 'SYSTEM' || chr(39) || '); end; / '
?from dba_segments a, dba_indexes b
?where a.tablespace_name IN ('GW_100M_DATN', 'GW_100M_IDXN')
?? and a.segment_type = 'INDEX'
?? and a.owner = b.owner
?? and a.segment_name = b.index_name

union

select 'begin dbms_stats.export_index_stats(ownname => ' || chr(39) ||

?????? b.owner || chr(39) || ',indname =>' || chr(39) || b.index_name ||

?????? chr(39) || ',stattab =>' || chr(39) || 'STAT_BK' || chr(39) ||

?????? ',statown =>' || chr(39) || 'SYSTEM' || chr(39) || '); end; / '
?from dba_segments a, dba_indexes b
?where a.tablespace_name IN ('GW_100M_DATN', 'GW_100M_IDXN')

??and a.segment_type = 'TABLE'
?? and a.owner = b.table_owner
?? and a.segment_name = b.table_name;

?

IMPORT 表的統(tǒng)計信息

begin

SYS.dbms_stats.IMPORT_TABLE_STATS(ownname => 'MESTST',tabname =>'ACTIONMAP',stattab =>'STAT_BK',cascade => true,statown=>'SYSTEM');

end;

/

轉(zhuǎn)載于:https://www.cnblogs.com/yifan268/archive/2011/01/27/1946353.html

總結(jié)

以上是生活随笔為你收集整理的统计信息的备份的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。