Oracle表、索引修改表空間語句指的是什么
表做空間遷移時,使用如下語句: 例1:alter table tb_name move tablespace tbs_name; 索引表空間做遷移,使用如下語句: 例2:alter index index_name rebuild tablespace tbs_name; 對于含有lob字段的表,在建立時,oracle會自動為lob字段建立兩個單獨的segment,一個用來存放數據,另一個用來存放索引,并且它們都會存儲在對應表指定的表空間中,而例1:只能移動非lob字段以外的數據,所以在對含有lob字段的表進行空間遷移,需要使用如下語句: 例3:alter table tb_name move tablespace tbs_name lob (col_lob1,col_lob2) store as(tablesapce tbs_name); 項目實例: 表空間遷移 select 'alter table' ||table_name|| 'move tablespace tbs_name;' table_name from dba_tables where owner='%***%' and table_name like '%***%' 帶lob字段 select 'alter table' ||table_name|| 'move lob('||index_name||') store as (tablespace tbs_name);' from dba_indexes where owner='%***%' and index_name like '%***%' 索引表空間 select 'alter index' ||index_name|| 'rebuild tablespace tbs_name;' index_name from dba_indexes where owner='%***%' and table_name like '%***%' 以上在oracle 的SQL*Plus Worksheet中運行,將得出的運行結果再運行一次即可。