Database Storage Structures

🧠 Introduction
Ever wondered how Oracle actually stores your data?

Let’s break it down β€” from big-picture storage like tablespaces, down to the tiniest data block.

Whether you’re using a CDB (Container Database) or PDB (Pluggable Database), these layers apply.

🧱 Storage: Two Levels – Physical and Logical

πŸ”Ή Physical Level – Where data is actually stored (on disk)
πŸ”Ή Logical Level – How Oracle organizes and manages that storage

Let’s look at each in detail ⬇️

πŸ—‚οΈ πŸ”Έ Physical Storage Options

Oracle can store data files using three main mechanisms:

  1. File System
    ➀ Traditional OS-based file structure
    ➀ Most Oracle DBs use this by default
  2. Cluster File System
    ➀ Used in Oracle RAC (Real Application Clusters)
    ➀ Makes shared storage look like a single file system
    ➀ Multiple servers can access the same data
  3. Oracle ASM (Automatic Storage Management)
    ➀ Oracle-managed storage
    ➀ Provides performance + reliability
    ➀ Reduces manual storage management

πŸ“Œ Data files = The actual files that store your tables, indexes, etc.

🧠 πŸ”Ή Logical Storage Structures (Inside Oracle)

LayerDescription
TablespaceA logical container for data. Can hold multiple segments. Each PDB has its own set of tablespaces.
SegmentSet of extents used by a schema object (like a table or index). One object = one segment.
ExtentSet of contiguous data blocks. More extents are added as needed.
Data BlockSmallest unit of logical storage. Usually 2KB, 4KB, 8KB, etc. Stored in data files.

πŸ” Flow of Storage:

Tablespace β†’ Segment β†’ Extent β†’ Data Block β†’ Data File

πŸ“¦ Tablespaces in Detail

βœ… USERS tablespace
➀ Default location for user data

βœ… Custom Tablespaces
➀ Can be created for separating system data, app-specific data, etc.

πŸ“Œ One tablespace = many data files
πŸ“Œ One data file = belongs to one tablespace only

πŸ› οΈ DBA Tip of the Day
Understanding how Oracle organizes storage helps you optimize performance and space usage.

When things go wrong β€” like fragmentation or storage alerts β€” this is where you start debugging.