http://oracle.chinaitlab.com/exploiture/737839.html
如果你將創建表和索引創建在USERS表空間下了,(注:在USERS表空間中是合理的),那麼在以後的維護中將會出現很多麻煩。
如果是oltp系統無法刪除重建,所以必須考慮在不影響使用的情況下做該項工作。
◆1、知道命令:
alter table table_name move tablespace tablespace_name;
所以考慮這個方向:
select ''alter table '' || table_name || '' move tablespace tablespace_name;'' from user_tables where tablespace_name = ''USERS'' |
得到該連接用戶下所有創建在USERS表空間下的表名。
◆2、執行所得到的語句,至此將錶轉移到新表空間中。
◆3、重建索引
得到重建索引語句
SELECT ''alter index ''||index_name||'' rebuild tablespace tablespace_name storage(¡­¡­);'' FROM USER_INDEXES T where t.table_owner=''USER_NAME'' and t.tablespace_name=''USERS'' |
◆4、執行得到的語句,將索引轉移到新表空間。
註釋:在此過程中全文索引的轉移會出錯,大家可以忽略不計。