Oracle uses the high-water mark after deleted rows in database, you can free up this space at the table level with following methods.
1 . using export/import of table -
For a complete restructuring of table and space freeing up export/import of a table allows us to restructure our files and release the lost space.
2. using dbms_redefinition -
This procedure will reorganize a table while it remains online for updates.
3. using alter table tmp shrink -
If you are using Oracle 10g and later, you could use
alter table tmp shrink space compact.
4. using coalesing table -
It removes space above the high-water mark, It puts together the uncontiguous fragmented extents.
The honeycomb fragmentation and Swiss Cheese fragmentation are mainly occured in oracle. When the free extents are side by side, its in honeycomb fragmentation, and when the extents are separated by live segments, its in Swiss Cheese fragmentation.
alter table tmp coalesce;
5. using deallocate unused space -
Oracle uses it to explicitly deallocate unused space at the end of a segment and makes that space available for other segments within the tablespace.
alter table tmp deallocate unused space;
Oracle deallocates unused space beginning from the end of the objects and moving downwards toward the beginning of the object, continuing down until it reaches the high water mark (HWM). For indexes, deallocate unused space coalesces all leaf blocks within same branch of b-tree, and quickly frees up index leaf blocks for use.
1 . using export/import of table -
For a complete restructuring of table and space freeing up export/import of a table allows us to restructure our files and release the lost space.
2. using dbms_redefinition -
This procedure will reorganize a table while it remains online for updates.
3. using alter table tmp shrink -
If you are using Oracle 10g and later, you could use
alter table tmp shrink space compact.
4. using coalesing table -
It removes space above the high-water mark, It puts together the uncontiguous fragmented extents.
The honeycomb fragmentation and Swiss Cheese fragmentation are mainly occured in oracle. When the free extents are side by side, its in honeycomb fragmentation, and when the extents are separated by live segments, its in Swiss Cheese fragmentation.
alter table tmp coalesce;
5. using deallocate unused space -
Oracle uses it to explicitly deallocate unused space at the end of a segment and makes that space available for other segments within the tablespace.
alter table tmp deallocate unused space;
Oracle deallocates unused space beginning from the end of the objects and moving downwards toward the beginning of the object, continuing down until it reaches the high water mark (HWM). For indexes, deallocate unused space coalesces all leaf blocks within same branch of b-tree, and quickly frees up index leaf blocks for use.