I'm trying to run the following:
db2 alter tablespace TABLESPACE1 reduce
I keep getting errors. As you can see, I have around 50% free pages. I'd like to shrink it in order to reclaim OS disk space.
Tablespace ID = 281
Name = TABLESPACE1
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Total pages = 8943720
Useable pages = 8943696
Used pages = 4559696
Free pages = 4384000
High water mark (pages) = 8914736
Page size (bytes) = 32768
Extent size (pages) = 8
Prefetch size (pages) = 24
Number of containers = 3
Minimum recovery time = 2014-12-09-16.28.18.000000
Container ID = 0
Name = /data/db2dat_10/sida1/TABLESPACE1_01.dbf
Type = File
Total pages = 2981240
Useable pages = 2981232
Accessible = Yes
Container ID = 1
Name = /data/db2dat_11/sida1/TABLESPACE1_02.dbf
Type = File
Total pages = 2981240
Useable pages = 2981232
Accessible = Yes
Container ID = 2
Name = /data/db2dat_12/sida1/TABLESPACE1_03.dbf
Type = File
Total pages = 2981240
Useable pages = 2981232
Accessible = Yes
Best Answer
I ended up figuring this one out.
Shrink a tablespace with DB2 9.5 is much more difficult. The reduce and resize command exist but will only work if the high water mark is low. You cannot use reduce or resize below the HWM size.
You need to use DB2DART -LHWM and have the database deactivated while doing so.