1. 程式人生 > >[轉]DB2中需要REORG操作的幾種情況

[轉]DB2中需要REORG操作的幾種情況

sting line lte font -type compress win rmi col

問題: 在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

[轉]DB2中需要REORG操作的幾種情況