alter table move 表空间迁移
实用DDL语句alter table move来完成此方案,利用脚本前台运行,共7个用户的所有对像要换表空间,因此为了安全,第一次操作用expdp导出一份做为备份,没有问题的话对其它可做不备份(时间充足备份更好),还有一点如对像的表和索引在同一个表空间的问题需要注意这一点,还有一点补充,如果在实验环境下表没有数据的话移动表索引还是有效的,因为索引是记录rowid,rowid没有索引当然不会失效。
1. 查看用户所有表和索引,及表空间,状态先记录下来,方便有问题的排除问题。
select t.table_name,t.tablespace_name,t.status 表状态,i.index_name,index_type,i.status 索引状
态,i.tablespace_name
from user_indexes i,user_tables t
where t.table_name=i.table_name;
2. 利用expdp导入用户全部对像,备份
3. 通过|||符制做表移动脚本 表 移动
For example: select 'alter table '||table_name||' move tablespace EXAMPLE nologling;' from user_tables;
如果需要在线移动的话可在nologging前面加online字句,nologling可以加快索引重建,因为这样不会对
索引重建操作生成重做数据。
4.通过||符制做索引移动脚本
For example: select 'alter index '||index_name||' rebuild tablespace EXAMPLE nologging;' from user_indexes;
如果不需要换空间就可不用tablespace EXAMPLE
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27252036/viewspace-774449/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/27252036/viewspace-774449/