2、改变分区已经存在和将来插入的数据的压缩方式。
SQL>alter table part_objects move partition p3 compress basic;
Table altered.
SQL>select table_name,partition_name,compression,compress_for
2 from user_tab_partitions
3 where table_name = 'PART_OBJECTS';
TABLE_NAME PARTITION_ COMPRESSION COMPRESS_FOR
------------ ---------- ---------------- ------------------------
PART_OBJECTS P1 ENABLED OLTP
PART_OBJECTS P2 ENABLED OLTP
PART_OBJECTS P3 ENABLED BASIC
如果一个表是非压缩的,或者想改变一个表的压缩方式可以通过以下的方式来改变。
SQL> select table_name,compression,compress_for
2 from user_tables
3 where table_name = 'EMPLOYEES';
TABLE_NAME COMPRESSION COMPRESS_FOR
------------ ---------------- ------------------------
EMPLOYEES DISABLED
SQL>alter table employees move compress basic;
Table altered.
SQL>select table_name,compression,compress_for
2 from user_tables
3 where table_name = 'EMPLOYEES';
TABLE_NAME COMPRESSION COMPRESS_FOR
------------ ---------------- ------------------------
EMPLOYEES ENABLED BASIC
压缩表上面存在的限制
1、使用basic compression 方式压缩的表不能删除列。
SQL> alter table employees drop column salary;
alter table employees drop column salary
*
ERROR at line 1:
ORA-39726: unsupported add/drop column operation on compressed tables
