oracle 表移动表空间

发布时间:2020-08-10 16:43:03 作者:star2588
来源:ITPUB博客 阅读:124

在oracle中有时需要把表移动到其他表空间中,下面是移动的步骤。
首先,使用下面的命令移动:
alter table table_name move tablespace tablespace_name;
然后,如果有索引的话必须重建索引:
alter index index_name rebuild tablespace tablespace_name;

需要注意的地方是:
1、若表中需要同时移动lob相关字段的数据,就必需用如下的含有特殊参数据的语句来完成。

alter table tb_name move tablespace tbs_name lob (col_lob1,col_lob2) store as(tablesapce tbs_name);

如果表特别多,可以生产一个执行的脚本。
select 'alter index '||OWNER||'.'||index_NAME||' rebuild tablespace tablespace_name;' from dba_indexes where OWNER='USERS';
select 'alter table '||OWNER||'.'||TABLE_NAME||' move tablespace tablespace_name;' from dba_tables where OWNER='USERS';

推荐阅读:
  1. oracle 表收缩
  2. oracle 索引建立小计

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

oracle 空间 移动

上一篇:@Repository、@Service、@Controller 和 @Component

下一篇:Oracle 11gASM新特性总结

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》