alter table move tablespace 新表空间名称;
alter table move lob(column_name) store as (tablespace tablespace_name);迁移lob 字段
1.查询迁移lob 字段
注意先迁移lob 字段,后执行表和索引,不然这个语句查不出来
select 'alter table ' ||c.table_name|| ' move lob('||c.column_name||') store as (tablespace SMOM_DATA);' from dba_tables s
left join dba_tab_columns c on s.table_name=c.table_name
where s.owner='SMOM_PROD' and s.tablespace_name = 'USERS' and c.data_type='CLOB';
2.查询迁移表
迁移源表空间所有表
select 'alter table ' ||table_name || ' move tablespace SMOM_DATA;'
from dba_tables where tablespace_name='USERS' and owner='SMOM_PROD';
3.查询需要重建的索引
select 'alter index ' ||index_name|| ' rebuild tablespace SMOM_DATA;' index_name from
dba_indexes where owner='SMOM_PROD' and tablespace_name like 'USERS' and index_type !='LOB';
注意重建索引
alter index index_name rebuild tablespace tbs_name;