关于move table和rebuild index批量操作的记录

批量move oldtablespace表空间下的table到newtablespace,查询并执行查询结果即可
select 'alter table '||table_name||' move tablespace newtablespace'
from user_all_tables 
where table_space='oldtablespace'; 

批量rebuild oldtablespace表空间下的index到newtablespace,查询并执行查询结果即可
select 'alter index '|| index_name || ' rebuild  tablespace newtablespace;'
from user_indexes
where  tablespace_name='oldtablespace' ;


带有lob字段的表做move时lob字段需要单独move

ALTER TABLE AUDIT_RECORD MOVE LOB(lobrow1) STORE AS (TABLESPACE newtablespace);
ALTER TABLE AUDIT_RECORD MOVE LOB(lobrow2) STORE AS (TABLESPACE newtablespace);
ALTER TABLE AUDIT_RECORD MOVE TABLESPACE newtablespace;

或者
ALTER TABLE test2 MOVE

              TABLESPACE users

                  LOB (lobrow1) STORE AS lobsegment

              (TABLESPACE newtablespace);

另外exp/imp迁移带有lob字段的  在执行IMP时需要将原lob字段所在的tablespace建好再导入,导入后再考虑move到其他tablespace
exped/imped可以用remap_tablespace参数指定将数据导入到指定的表空间,无需考虑该项

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29320885/viewspace-1717050/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29320885/viewspace-1717050/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值