环境: DB2 10.5.3

ISIMDB

1.判断当前的表空间和High Water Mark

db2pd -d isimdb -tablespace

输出:

留意UsedPgs和HWM之间的差异,如果HWM显著高于UsedPgs,则可以进行降水位操作

2. 执行降水位操作

$ db2 “alter tablespace enrole_data reduce(all containers 400G)”
DB20000I The SQL command completed successfully.

3. 对比降水位前后的磁盘使用情况:

enrole_data文件之前500G,现在88G。

回收了400G空间

备注: 某些文档不能无脑照抄,这个enrole_data表空间特殊,无法直接reduce max,

$ db2 “alter tablespace enrole data reduce max”
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned:
会报错:
SQL1763N Invalid ALTER TABLESPACE statement for table space “ENROLE_DATA” due to reason “10” SOLSTATE=429BC