oracle表添加字段报错,ORA-22856 Oracle 9i 压缩表添加字段报错的处理方法

ORA-22856 Oracle 9i 压缩表添加字段报错的处理方法

在oracle 9i版本中,如果表是compress,在添加字段时会报ORA-22856: cannot add columns to object tables错误,这是一个BUG(在10G及以上版本中不存在本文所述的问题),用以下方法可以绕过:

1.alter table nocompress

2.alter table move

3.alter table add column(添加字段)

注意:

1.不用直接用alter table move nocompress,一定要先指定nocompress,然后move,不然加字段还是出错

2.如果表有索引,还得rebuild一下索引

3.如要恢复compress属性,就在加完字段后,再次指定compress属性,再次move即可

4.在10G及以上版本中不存在以上问题

实验记录:

SQL> create table t3(a number(2),b number(2)) compress;

Table created.

SQL> insert into t3 values (1,1);

1 row created.

SQL> /

1 row created.

SQL> /

1 row created.

SQL> /

1 row created.

SQL> /

1 row created.

SQL> commit;

SQL> alter table t3 add (c number(2));

alter table t3 add (c number(2))

*

ERROR at line 1:

ORA-22856: cannot add columns to object tables

SQL>

SQL> alter table t3 move nocompress;

Table altered.

SQL> alter table t3 add (c number(2));

alter table t3 add (c number(2))

*

ERROR at line 1:

ORA-22856: cannot add columns to object tables

SQL> alter table t3 nocompress;

Table altered.

SQL> alter table t3 move;

Table altered.

SQL> alter table t3 add (c number(2));

Table altered.

作者:george.ma Blog:http://blog.chinaunix.net/u/12521/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值