Blocks, Extents and Segments

Oracle DBA Certification 12 min min read Updated: Nov 16, 2026 Beginner
Blocks, Extents and Segments
Beginner Topic 2 of 6

The Storage Hierarchy

LevelMeaningSize
Data blockSmallest unit Oracle reads or writesUsually 8 KB
ExtentA group of contiguous blocksGrows as needed
SegmentAll extents of one object (table, index...)Whole object
TablespaceHolds many segmentsOne or more datafiles
Simple example: A block is one page. An extent is a chapter. A segment is the whole book. The tablespace is the bookshelf.

Types of Segments

  • Table and index segments (the ones you create)
  • Undo segments
  • Temporary segments created during sorts
  • LOB segments for large objects

Look at the Space

sql SELECT segment_name, segment_type, extents, blocks, ROUND(bytes/1024) AS kb FROM dba_segments WHERE owner = 'SHOP'; SELECT extent_id, blocks, ROUND(bytes/1024) AS kb FROM dba_extents WHERE owner = 'SHOP' AND segment_name = 'ORDERS';

Block Size

sql SHOW PARAMETER db_block_size

The default is 8192 bytes. It is set when the database is created and cannot be changed later for the main tablespaces.

Space Management

Modern tablespaces use locally managed tablespaces with automatic segment space management (ASSM). Oracle tracks free space inside blocks for you. This is the default, so you usually do not need to configure anything.

The High Water Mark

The high water mark (HWM) is the highest point a table has ever filled. A full table scan reads up to the HWM, even if you deleted most rows. That is why a table with few rows can still be slow.

sql -- delete does NOT lower the high water mark DELETE FROM big_table WHERE created < SYSDATE - 365; COMMIT;

Reclaim Space

MethodCommandNotes
ShrinkALTER TABLE t ENABLE ROW MOVEMENT; ALTER TABLE t SHRINK SPACE;Online, needs ASSM tablespace
MoveALTER TABLE t MOVE ONLINE;Rebuilds the table. Indexes may need a rebuild on older versions.
TruncateTRUNCATE TABLE t;Fast, removes all rows, resets the HWM
sql ALTER TABLE shop.orders ENABLE ROW MOVEMENT; ALTER TABLE shop.orders SHRINK SPACE CASCADE;
Tip: Shrinking returns space inside the tablespace. To return space to the operating system, you also resize the datafile, and that only works if the free space is at the end of the file.

Conclusion

Blocks make extents, extents make segments, and segments live in tablespaces. Deleting rows does not lower the HWM, so shrink or move a table to reclaim space.

Quick Summary: Block < extent < segment < tablespace. DELETE keeps the HWM; SHRINK SPACE or MOVE reclaims it.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators