oracle compress 表需要 move uncompress 在add column

1.普通表(未分区)


1.SQL> Alter Table tb_hxl_id Compress;

2.

3.Table altered.

4.

5.SQL> Alter Table tb_hxl_id Move Compress;

6.

7.Table altered.

8.

9.SQL> Alter Table tb_hxl_id Add c Varchar2(2);

10.

11.Table altered.

12.

13.SQL> Alter Table tb_hxl_id Drop Column c;

14.Alter Table tb_hxl_id Drop Column c

15.                                  *

16.ERROR at line 1:

17.ORA-39726: unsupported add/drop column operation on compressed tables

18.

19.

20.SQL> Alter Table tb_hxl_id Move Nocompress; -- 需要进行解压缩后才能删除字段

21.

22.

23.Table altered.

24.

25.SQL> Alter Table tb_hxl_id Drop Column c;

26.

27.Table altered.



2.分区表



1.SQL> Select aa.table_name,aa.partitioning_type

2.  2 From dba_part_tables aa

3.  3 Where aa.table_name = 'TB_HXL_LIST';

4.

5.TABLE_NAME PARTITION

6.------------------------------ ---------

7.

8.TB_HXL_LIST LIST

9.

10.SQL> Select

11.  2 aa.compression,

12.  3 aa.partition_name

13.  4 From dba_tab_partitions aa

14.  5 Where aa.table_name = 'TB_HXL_LIST';

15.

16.COMPRESS PARTITION_NAME

17.-------- ------------------------------

18.

19.ENABLED P_L1

20.ENABLED P_L2

21.ENABLED P_L3

22.ENABLED P_L4

23.

24.SQL> Alter Table tb_hxl_list compress;

25.

26.Table altered.

27.

28.SQL> Alter Table TB_HXL_LIST

29.  2 Move Partition P_L1 compress;

30.

31.Table altered.

32.

33.SQL> Alter Table TB_HXL_LIST Add b Varchar2(2);

34.

35.Table altered.

36.

37.SQL> Alter Table TB_HXL_LIST Drop Column b;

38.Alter Table TB_HXL_LIST Drop Column b

39.                                    *

40.ERROR at line 1:

41.ORA-39726: unsupported add/drop column operation on compressed tables

42.

43.

44.SQL> Alter Table TB_HXL_LIST

45.  2 Move Partition P_L1 Nocompress;

46.

47.Table altered.

48.

49.SQL> Alter Table TB_HXL_LIST Drop Column b;

50.Alter Table TB_HXL_LIST Drop Column b

51.                                    *

52.ERROR at line 1:

53.ORA-39726: unsupported add/drop column operation on compressed tables

54.

55.SQL> alter table TB_HXL_LIST set unused column b; -- 压缩的分区表不能删除字段,只能设置unused

56.

57.

58.Table altered.

ORA-39726: unsupported add/drop column operation on compressed tables
Cause: An unsupported add/drop column operation for compressed table was attemped.
Action: When adding a column, do not specify a default value. DROP column is only supported in the form of SET UNUSED column (meta-data drop column).

猜你喜欢

转载自dannyhz.iteye.com/blog/2328976