Oracle数据库转移表

1. 对于普通的表

     alter table table_name move tablespace new_space_name;

     后重建索引

     alter index index_name rebuild [tablespace new_space_name] ;

      即可完成表的迁移空间的操作。

2. 对于含有Lob字段的表

     因为在建立含有lob字段的表时,oracle会自动为lob字段建立两个单独的segment,一个用来存放lob数据,另一个用来存放lob索引,并且它们都会存储在对应表指定的表空间中。

     可以通过   select segment_name,segment_type,tablespace_name   from dba_segments   where owner=userid;

    查询,会发现有

  SYS_IL0000026875C00002$$ LOBINDEX 
  SYS_LOB0000026875C00001$$ LOBSEGMENT

    在移动表到新空间时,同时也要将lobindex和lobsegment移动到新的表空间。

      alter table table_name move tablespace new_space_name lob(lob_column) store as(tablespace new_space_name );

    然后重建此表的其他索引就可。

原文地址:https://www.cnblogs.com/cthulhu/p/2441991.html