Oracle shrink space release space to operational system in one step?
Question
Does oracle release space to operational system when is issued alter table ... shrink space
(one step) or just after move HWM (two steps) alter table ... shrink space compact
?
Solution
Table Shrinking is not about freeing space for OS, but replacing the blocks freed due to UPDATE
and DELETE
operations, with the used blocks. Thus, reducing the load on the database during table scans. Moving HWM does not 'give back' the free blocks to OS, it just indicates where the used blocks end, therefore Oracle knows there is no data after that.
Managing OS space for a database is done in OS layer, if you want to free up some space in OS, and you know that there are some free blocks inside Oracle datafiles, you have to take a dump using Oracle Datapump (expdp
and impdp
), drop the datafile, re-create the datafile with AUTOEXTEND
option and then import your dump.