Rebuild all index in a tablespace ( 重建所有指定Tablespace 的 Index )

0

先運行以下 SQL 抽出 Tablespace 內所有 index 找出來:

select 'alter index '||owner||'.'||index_name ||' rebuild online nologging;'
from all_indexes
WHERE tablespace_name = '[[Tablespace 名]]';

Result 會大約如下 :

alter index DB1.AAAA rebuild online ;
alter index DB1.BBBB rebuild online ;
alter index DB1.CCCC rebuild online ;
alter index DB1.DDDD rebuild online ;
alter index DB1.EEEE rebuild online ;

再把Result 當 SQL 再運行一次 :

alter index DB1.AAAA rebuild online ;
alter index DB1.BBBB rebuild online ;
alter index DB1.CCCC rebuild online ;
alter index DB1.DDDD rebuild online ;
alter index DB1.EEEE rebuild online ;

大功告成, 享受一杯咖啡, 等待結果….

Share.

About Author

hahahahahaha......nothing here

發表迴響