alter table move tablespace 新表空间名称;

    alter table move lob(column_name) store as (tablespace tablespace_name);迁移lob 字段
    1.查询迁移lob 字段
    注意先迁移lob 字段,后执行表和索引,不然这个语句查不出来

    1. select 'alter table ' ||c.table_name|| ' move lob('||c.column_name||') store as (tablespace SMOM_DATA);' from dba_tables s
    2. left join dba_tab_columns c on s.table_name=c.table_name
    3. where s.owner='SMOM_PROD' and s.tablespace_name = 'USERS' and c.data_type='CLOB';

    2.查询迁移表
    迁移源表空间所有表

    1. select 'alter table ' ||table_name || ' move tablespace SMOM_DATA;'
    2. from dba_tables where tablespace_name='USERS' and owner='SMOM_PROD';

    3.查询需要重建的索引

    1. select 'alter index ' ||index_name|| ' rebuild tablespace SMOM_DATA;' index_name from
    2. dba_indexes where owner='SMOM_PROD' and tablespace_name like 'USERS' and index_type !='LOB';

    注意重建索引

    1. alter index index_name rebuild tablespace tbs_name;