测试:
1. 新建一个表T2,并插入数据,观察到所占空间:DATA_OBJECT_L_SIZE为512byte, LOB_OBJECT_L_SIZE为131460
db2 "create table t2(id int, address clob (32 k)) in tbs2 long in LONGTBS"
//insert some data here
db2 "SELECT substr(TABSCHEMA,1,10) as TABSCHEMA, substr(TABNAME,1,10) as TABNAME, DATA_OBJECT_L_SIZE, LOB_OBJECT_L_SIZE FROM SYSIBMADM.ADMINTABINFO WHERE TABNAME='T2' "
TABSCHEMA TABNAME DATA_OBJECT_L_SIZE LOB_OBJECT_L_SIZE
---------- ---------- -------------------- --------------------
MIAOQINGSO T2 512 131460
1 record(s) selected.
db2 "delete from t2"
db2 "SELECT substr(TABSCHEMA,1,10) as TABSCHEMA, substr(TABNAME,1,10) as TABNAME, DATA_OBJECT_L_SIZE, LOB_OBJECT_L_SIZE FROM SYSIBMADM.ADMINTABINFO WHERE TABNAME='T2' "
TABSCHEMA TABNAME DATA_OBJECT_L_SIZE LOB_OBJECT_L_SIZE
---------- ---------- -------------------- --------------------
MIAOQINGSO T2 512 131460
1 record(s) selected.
db2 "reorg table t2"
db2 "SELECT substr(TABSCHEMA,1,10) as TABSCHEMA, substr(TABNAME,1,10) as TABNAME, DATA_OBJECT_L_SIZE, LOB_OBJECT_L_SIZE FROM SYSIBMADM.ADMINTABINFO WHERE TABNAME='T2' "
TABSCHEMA TABNAME DATA_OBJECT_L_SIZE LOB_OBJECT_L_SIZE
---------- ---------- -------------------- --------------------
MIAOQINGSO T2 256 131460
1 record(s) selected.
db2 "reorg table t2 LONGLOBDATA"
db2 "SELECT substr(TABSCHEMA,1,10) as TABSCHEMA, substr(TABNAME,1,10) as TABNAME, DATA_OBJECT_L_SIZE, LOB_OBJECT_L_SIZE FROM SYSIBMADM.ADMINTABINFO WHERE TABNAME='T2' "
TABSCHEMA TABNAME DATA_OBJECT_L_SIZE LOB_OBJECT_L_SIZE
---------- ---------- -------------------- --------------------
MIAOQINGSO T2 256 260
1 record(s) selected.
https://www.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001966.html
也有一些例外情况,reorg时不需要加上LONGLOBDATA的,参考如下
http://www-01.ibm.com/support/docview.wss?uid=swg21661779