如题,表tabel现在所在的表空间为tabelspaceA,现要将tabel的数据移动到tabelspaceB,tabel表有索引,有表分区。

解决方案 »

  1.   


    alter table table_name move tablespace tablespace_name(非分区表)用move移动时候要注意:
    1、索引需要重build
    2、move操作会锁表,对于操作繁忙的表做move可能影响深远
      

  2.   

    索引也移动到指定的表空间
    ALTER INDEX INDEX_NAME REBUILD TABLESPACE TABLESPACE_NAME; 
      

  3.   

    分区表的移动,应该要写个过程,遍历user_tab_partitions,对每一个分区进行移动:select 'alter table '|| table_name || ' move partition ' || partition_name ||' tablespace XXXX;'
    from user_tab_partitions
    where table_name ='XXX'
    ;
      

  4.   

    1.移动普通表
    alter table tablename move tablespace users;
    2。分区表,单个移动
    alter table partitioned_tab move partition part1 tablespace newtablespace1;
    alter table partitioned_tab move partition part2 tablespace newtablespace2;
      

  5.   

    --你的目的就是复制表 建议这样
    create table table1 as select * from user.tabel --user 就是创建此表的用户在user登陆 
    set long 1000
    select dbms_metadata.get_ddl('TABLE','TABEL','USER') FROM DUAL  查看表的定义约束 在在目的表加同样的约束
      

  6.   

    --2 
    --普通表
    alter table tabel move tablespace tabelspaceB
    --分区表
    alter table tabel move partition PARTITION_NAME move tablespaceB--移动表索引会失效所以必须重建
    alter index index_name rebuild tablespace tabelspaceB  --重建索引
      

  7.   

    --普通表
    alter table tabel move tablespace tabelspaceB
    --分区表
    alter table tabel move partition PARTITION_NAME move tablespaceB--移动表索引会失效所以必须重建索引
    alter index index_name rebuild tablespace tabelspaceB 
      

  8.   


    select 'alter table '|| table_name || ' move partition ' || partition_name ||' tablespace XXXX;'
    from user_tab_partitions
    where table_name ='XXX'
    ;

    学习…
      

  9.   

    alter table_name move tablespace tablespace_name;