move分区表

现在需要将一些分区表移到别的表空间下去,且该表是arc表,目前是没有任何程序访问,不需使用在线重定义,可以直接move.
SQL> alter table JUSTIN move tablespace ARC;
alter table JUSTIN move tablespace ARC
            *
ERROR at line 1:
ORA-14511: cannot perform. operation on a partitioned object

分区表必须以分区为单位进行move,可以使用以下sql

Elapsed: 00:00:00.00
SQL> select 'alter table '||table_name||' move partition '||partition_name||' tablespace ARC;' from user_tab_partitions where table_name ='JUSTIN';

'ALTERTABLE'||TABLE_NAME||'MOVEPARTITION'||PARTITION_NAME||'TABLESPACEARC
--------------------------------------------------------------------------------
alter table JUSTIN move partition P0912 tablespace ARC;
alter table JUSTIN move partition P1003 tablespace ARC;
alter table JUSTIN move partition P1006 tablespace ARC;
alter table JUSTIN move partition P1009 tablespace ARC;
alter table JUSTIN move partition P1012 tablespace ARC;
alter table JUSTIN move partition P1103 tablespace ARC;
alter table JUSTIN move partition P1106 tablespace ARC;
alter table JUSTIN move partition P1109 tablespace ARC;
alter table JUSTIN move partition P1112 tablespace ARC;
alter table JUSTIN move partition P1203 tablespace ARC;
alter table JUSTIN move partition P1206 tablespace ARC;

11 rows selected.

Elapsed: 00:00:00.07
SQL> alter table JUSTIN move partition P0912 tablespace ARC;
alter table JUSTIN move partition P1003 tablespace ARC;
alter table JUSTIN move partition P1006 tablespace ARC;
alter table JUSTIN move partition P1009 tablespace ARC;
alter table JUSTIN move partition P1012 tablespace ARC;
alter table JUSTIN move partition P1103 tablespace ARC;
alter table JUSTIN move partition P1106 tablespace ARC;
alter table JUSTIN move partition P1109 tablespace ARC;
alter table JUSTIN move partition P1112 tablespace ARC;
alter table JUSTIN move partition P1203 tablespace ARC;
alter table JUSTIN move partition P1206 tablespace ARC;

Table altered.

Elapsed: 00:00:16.12
SQL>
Table altered.

Elapsed: 00:00:06.99
SQL>
Table altered.

Elapsed: 00:00:13.04
SQL>
Table altered.

Elapsed: 00:00:20.05
SQL>
Table altered.

Elapsed: 00:00:07.36
SQL>
Table altered.

Elapsed: 00:00:00.07
SQL>
Table altered.

Elapsed: 00:00:00.03
SQL>
Table altered.

Elapsed: 00:00:00.04
SQL>
Table altered.

Elapsed: 00:00:00.04
SQL>
Table altered.

Elapsed: 00:00:00.04
SQL>
Table altered.

Elapsed: 00:00:00.03
接下来需要重建索引,分区表上的索引分为分区索引和全局索引,需要区别开来进行重建
重建分区索引
SQL> select 'alter index '||index_name||' rebuild partition '||partition_name||' online tablespace  ARC;' from user_ind_partitions where index_name in (
  2  select index_name from user_indexes where table_name ='JUSTIN')  status != 'USABLE';

no rows selected
重建全局索引
SQL> select 'alter index '||index_name||' rebuild online tablespace  ARC;' from user_indexes where table_name ='JUSTIN'
  2  and status != 'USABLE';

no rows selected
不过这个arch表没有索引,那就不需要重建了,move完成。

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

转载于:http://blog.itpub.net/15480802/viewspace-709372/

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值