首页 > 其他 > 详细

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

时间:2015-07-02 02:21:01      阅读:294      评论:0      收藏:0      [点我收藏+]
批量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参数指定将数据导入到指定的表空间,无需考虑该项

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

原文:http://blog.itpub.net/29320885/viewspace-1717050/

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!