Chapter 03 · Physical Storage: Datafiles, Tablespaces, Blocks, Segments, Extents, and ASM Concepts

Database Blocks, Extents, Segments, Tablespaces, Datafiles, and Space Allocation

Trace Oracle storage from rows and schema objects through segments, extents, blocks, tablespaces, datafiles, and lower storage with current metadata evidence.

Intermediate → Advanced100–120 minutesLogical-to-physical storage evidence labOracle AI Database 26ai · RU 23.26.3 baselineFREEPDB1 + SQLcl/SQL*PlusLast reviewed: August 2026

Learning outcomes

Chapter 02 showed the running Oracle instance. Chapter 03 follows a ServiceHub row downward until it reaches persistent storage. A common mistake is to collapse every layer into “the datafile”: a table is not a file, an extent is not an operating-system extent, and free bytes inside a tablespace are not automatically free bytes on the host filesystem. This lesson builds the hierarchy precisely enough to diagnose capacity, placement, and recovery problems later.

01

Walk from a row and schema object to segment, extent, Oracle data block, tablespace, datafile, and operating-system storage.

02

Explain which storage layers are logical, which are physical, and which boundaries Oracle exposes to administrators.

03

Use DBA_SEGMENTS, DBA_EXTENTS, DBA_TABLESPACES, DBA_DATA_FILES, and DBA_FREE_SPACE to observe real allocation in FREEPDB1.

04

Distinguish allocated segment space, free space inside a tablespace, datafile size, and host/container filesystem free space.

05

Create and remove a disposable ServiceHub probe object without assuming a copied datafile path or altering production-like storage.

Container and privilege boundary

Run administrative catalog queries in the disposable FREEPDB1 lab with a privileged course-admin connection. Run object creation as SERVICEHUB_OWNER. Always confirm SHOW CON_NAME before storage DDL. This lesson does not resize, move, offline, or drop any existing course datafile.

1. The storage hierarchy is a chain of ownership and allocation

A table such as SERVICEHUB_OWNER.WORK_ORDERS is a logical schema object. The object consumes storage through a segment. A segment is made from one or more extents; each extent is a set of logically contiguous Oracle data blocks. A segment belongs to one tablespace and cannot span tablespaces, but different extents of that segment can reside in different datafiles of the same smallfile tablespace.

A tablespace is a logical database storage container. A permanent tablespace is backed by one or more physical datafiles; a temporary tablespace is backed by tempfiles. A datafile belongs to one tablespace. Below the datafile, the operating system, filesystem, logical volume, cloud block device, or Oracle Automatic Storage Management (ASM) layer maps file I/O to physical storage. Oracle data blocks and operating-system blocks are therefore related by I/O, but they are not the same unit.

Layer What it means Important boundary
Schema object Table, index, LOB, partition, and similar logical database object Object identity and semantics are not a file path.
Segment Storage allocated to an object or object partition One segment stays in one tablespace.
Extent A chunk of blocks allocated to one segment One extent is contained in one datafile.
Oracle block Smallest logical database I/O/storage unit Block size is a database/tablespace property, not necessarily OS block size.
Tablespace Logical storage container Maps logical allocation policy to one or more files.
Datafile/tempfile Persistent/temporary physical file known to Oracle File size is not the same as currently used object bytes.
Storage beneath file Filesystem/LVM/cloud volume/ASM disks Capacity, redundancy and I/O behavior belong to a lower layer.

2. Observe the current tablespace and file map before creating anything

Start by discovering the actual Free lab. Oracle AI Database 26ai databases created from current DBCA templates default to bigfile tablespaces, including SYSTEM, SYSAUX, and USER, but databases upgraded from older releases retain their tablespace type. That means a screenshot from another installation is not evidence for your environment.

sqlcl / sql*plus + sql · inventory tablespace policy and physical files
SHOW CON_NAMESELECT tablespace_name, contents, status, block_size,       extent_management, allocation_type,       segment_space_management, bigfileFROM   dba_tablespacesORDER  BY tablespace_name;SELECT file_id, tablespace_name, file_name,       ROUND(bytes/1024/1024,1) AS size_mb,       autoextensible,       ROUND(maxbytes/1024/1024,1) AS max_mb,       increment_byFROM   dba_data_filesORDER  BY tablespace_name, file_id;

Inside a PDB, these views describe the current container’s visible files/tablespaces. A CDB root has a different scope. Record the container with the evidence so a later operator does not mistake a PDB-local file inventory for the entire CDB.

3. Find the segment behind a ServiceHub table

Oracle allocates a segment when the object needs segment storage. Deferred segment creation can mean an empty table has no allocated segment yet, so “table exists” does not always imply “segment exists.” The established ServiceHub tables contain rows, so they should have allocated table segments.

sql · map ServiceHub objects to segments
SELECT owner, segment_name, segment_type, tablespace_name,       header_file, header_block,       ROUND(bytes/1024/1024,2) AS allocated_mb,       blocks, extentsFROM   dba_segmentsWHERE  owner = 'SERVICEHUB_OWNER'ORDER  BY segment_type, segment_name;

DBA_SEGMENTS.BYTES is allocated segment space. It is not “business data size,” and it is not the size of the datafile. Blocks can contain free space, block metadata, row overhead, migrated/chained rows, or reusable space. Later lessons will distinguish logical row volume from segment allocation and optimizer statistics.

4. Extents connect a segment to one or more datafiles

When a segment needs more room, Oracle allocates another extent according to the tablespace’s locally managed allocation policy. An extent is contained within one datafile. In a smallfile tablespace, later extents for the same segment may land in another datafile; in a bigfile tablespace there is only one datafile by definition.

sql · show extent placement for one ServiceHub segment
SELECT owner, segment_name, segment_type,       extent_id, file_id, block_id, blocks,       ROUND(bytes/1024,1) AS extent_kbFROM   dba_extentsWHERE  owner = 'SERVICEHUB_OWNER'AND    segment_name = 'WORK_ORDERS'ORDER  BY extent_id;SELECT file_id, tablespace_name, file_nameFROM   dba_data_filesWHERE  file_id IN (  SELECT DISTINCT file_id  FROM   dba_extents  WHERE  owner = 'SERVICEHUB_OWNER'  AND    segment_name = 'WORK_ORDERS')ORDER  BY file_id;

The BLOCK_ID is an Oracle block address within the file, not an operating-system sector number. Oracle controls database-block allocation; the filesystem or ASM separately controls how file blocks map to storage devices.

5. Allocated, free-inside-the-tablespace, and free-on-disk are three measurements

Administrators often say “we have 20 GB free” without naming the layer. DBA_FREE_SPACE reports free extents available for allocation inside permanent tablespaces. DBA_DATA_FILES.BYTES reports file size known to Oracle. The host’s filesystem free space is an operating-system fact. Autoextend can consume host space later, so a tablespace can look comfortable while the filesystem is close to exhaustion.

sql · calculate permanent tablespace allocation and free extents
WITH df AS (  SELECT tablespace_name, SUM(bytes) bytes  FROM   dba_data_files  GROUP  BY tablespace_name), fs AS (  SELECT tablespace_name, SUM(bytes) bytes  FROM   dba_free_space  GROUP  BY tablespace_name)SELECT df.tablespace_name,       ROUND(df.bytes/1024/1024,1) AS file_mb,       ROUND(NVL(fs.bytes,0)/1024/1024,1) AS free_extent_mb,       ROUND((df.bytes-NVL(fs.bytes,0))/1024/1024,1) AS allocated_or_not_free_mbFROM   dfLEFT JOIN fs ON fs.tablespace_name = df.tablespace_nameORDER  BY df.tablespace_name;

This is a capacity view, not an exact “user rows consume X MB” report. SYSTEM metadata, segment headers, extents, and other allocations contribute. It also says nothing about filesystem snapshots, thin provisioning, ASM usable space, or storage-array capacity.

6. Deliberately wrong approach: treat a table as a datafile

An operator sees WORK_ORDERS in the USERS tablespace and says “its file is users01.dbf, so moving or deleting that file only affects this table.” That inference is unsafe. A datafile can contain extents from many segments, and a tablespace can contain many unrelated objects. Removing or corrupting a datafile is a database recovery event, not object cleanup.

The repair is to move downward through metadata: object → segment → extents → file IDs → datafiles. Only after identifying every dependent object and recovery implication should a file-level action even be considered. This chapter does not perform datafile removal.

sql · prove that a file can contain many segments
SELECT e.file_id,       COUNT(DISTINCT e.owner || '.' || e.segment_name) AS distinct_segments,       ROUND(SUM(e.bytes)/1024/1024,1) AS extent_mbFROM   dba_extents eWHERE  e.tablespace_name = (  SELECT tablespace_name  FROM   dba_segments  WHERE  owner='SERVICEHUB_OWNER'  AND    segment_name='WORK_ORDERS'  FETCH FIRST 1 ROW ONLY)GROUP  BY e.file_idORDER  BY e.file_id;

Even this query should be interpreted carefully: segment names are not globally unique across owners and partition/subpartition metadata adds more identity dimensions. Its purpose is to break the “one table = one file” mental model.

7. Hands-on lab: create a disposable segment and watch extents appear

Connect as SERVICEHUB_OWNER to FREEPDB1. Create a probe table in the owner’s current default tablespace rather than hard-coding a datafile path. The payload is deliberately modest so it stays well within the Free 12-GB user-data limit.

sql · create and observe a disposable segment
CREATE TABLE servicehub_storage_probe ASSELECT LEVEL AS probe_id,       RPAD('x', 180, 'x') AS payloadFROM   dualCONNECT BY LEVEL <= 20000;SELECT segment_name, segment_type, tablespace_name,       ROUND(bytes/1024/1024,2) AS allocated_mb,       blocks, extentsFROM   user_segmentsWHERE  segment_name = 'SERVICEHUB_STORAGE_PROBE';SELECT extent_id, file_id, block_id, blocks,       ROUND(bytes/1024,1) AS extent_kbFROM   user_extentsWHERE  segment_name = 'SERVICEHUB_STORAGE_PROBE'ORDER  BY extent_id;DROP TABLE servicehub_storage_probe PURGE;

Verification: capture the segment’s tablespace, extent count, file IDs, and allocated bytes before dropping it. After the drop, the object’s segment/extents disappear and their space becomes reusable inside the tablespace; the physical datafile does not automatically become smaller. Lesson 3 explains that reclamation boundary.

8. Production judgment

Storage decisions should be made at the correct layer. Tablespace design controls logical placement, allocation policy, and administration. Datafile design affects file count, growth, backup/recovery work, and storage integration. The underlying filesystem/ASM/cloud volume controls physical capacity and redundancy. Monitoring must correlate all three layers, especially when autoextend or thin provisioning can defer a failure until the next growth event.

For production evidence, record the exact CDB/PDB scope, datafile/tablespace type, Oracle Managed Files usage, autoextend/maxsize, filesystem or ASM capacity, backup/recovery implications, and the current Oracle RU. Do not use hidden parameters or “one file per object” folklore as a substitute for measured capacity and recovery design.

9. Summary and next step

You can now follow a ServiceHub row from object semantics to segment, extents, Oracle blocks, tablespace, datafile, and lower storage. You also know that allocated segment bytes, free extents, file size, and host free space are different measurements. Lesson 2 separates permanent, temporary, and undo storage and then evaluates bigfile versus smallfile tablespaces without treating file size as a performance shortcut.

Check your understanding

  1. Can one segment span multiple tablespaces?
  2. Can one segment have extents in multiple datafiles?
  3. Why does DBA_SEGMENTS.BYTES not equal the size of business rows?
  4. Why can a tablespace have free space while the host filesystem is nearly full?
  5. What does dropping a table normally do to the physical datafile size?
Review the answers

No. A segment belongs to one tablespace.

Yes, if the tablespace can have multiple datafiles; each individual extent remains within one datafile.

It reports allocated segment space, which includes block/segment overhead and reusable/free room inside allocated blocks/extents.

Free extents are already inside allocated datafiles. Autoextend may need additional host storage later, and thin-provisioned lower layers have their own capacity.

It releases the segment/extents for reuse inside the tablespace. It does not automatically shrink the datafile at the operating-system layer.

Authoritative references

Keep knowledge open

Help the academy stay free and grow.

If these tutorials save you time, a small donation supports new lessons, technical review, diagrams, examples, and long-term maintenance.

ETHEthereum / ERC-20 only
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0

Send only Ethereum or ERC-20 compatible assets to this address.