问题: 在DB2数据库中,修改完表的结构时,是否需要对表做一个reorg操作才能使表的状态恢复正常?
答:有以下4种操作,需要对表做reorg操作
1. SET DATA TYPE altered-data-type
但有以下两种情况是例外,不需要reorg:
1). Increasing the length of a VARCHAR or VARGRAPHIC column
2). Decreasing the length of a VARCHAR or VARGRAPHIC column without truncating trailing blanks from existing data
2. SET NOT NULL
3. DROP NOT NULL
4. DROP COLUMN
其他的操作,理论上都不需要REORG,但有些操作,是需要REORG之后才能实际生效的,比如"ALTER TABLE ... COMPRESS YES",语法上不需要REORG操作,也不会影响表的增删改查操作,但只有REORG之后,才能真正开启压缩:
After a table has been altered to enable row compression, all rows in the table can be compressed immediately by performing one of the following actions:
1. REORG command
2. Online table move
3. Data unload and reload
时间: 2024-11-05 16:40:39