| Lesson 5 |
Datafiles |
| Objective |
Understand the role of datafiles and how Oracle manages them in modern environments. |
Oracle Datafiles
Datafiles make up the largest portion of an Oracle database in terms of disk space. Each datafile physically stores the database objects (tables, indexes, undo segments, and so forth) that belong to a specific tablespace.
To quickly list datafiles in your database and their sizes, query the V$DATAFILE view:
SQL> COLUMN name FORMAT A35
SQL> COLUMN status FORMAT A6
SQL> COLUMN bytes FORMAT 999,999,999
SQL> SELECT name, status, bytes
2 FROM v$datafile;
NAME STATUS BYTES
-------------------------------- ------ ------------
C:\ORANT\DATABASE\SYS1ORCL.ORA SYSTEM 31,457,280
C:\ORANT\DATABASE\USR1ORCL.ORA ONLINE 3,145,728
C:\ORANT\DATABASE\RBS1ORCL.ORA ONLINE 5,242,880
C:\ORANT\DATABASE\TMP1ORCL.ORA ONLINE 2,097,152
Interpreting the Datafile View
You can run the
SELECT query without formatting if you don’t mind long lines wrapping on screen. The
STATUS column indicates whether a datafile is accessible.
- ONLINE: The file is open and available for use.
- SYSTEM: The file belongs to the system tablespace, which contains the data dictionary. This tablespace is always online while the database is open.
The
BYTES column shows the size of the datafile. For example, the SYS1ORCL.ORA file is approximately 31 MB.
Modern Storage Integration
Oracle databases now rely on advanced storage technologies that go beyond older file mapping methods. These solutions improve scalability, redundancy, and performance:
- Automatic Storage Management (ASM)
- Groups physical disks into disk groups (e.g.,
+DATA for datafiles, +FRA for backups).
- Provides striping to spread I/O evenly across disks for better performance.
- Offers redundancy through mirroring, independent of hardware RAID.
- Supports Real Application Clusters (RAC) for cluster-wide access.
- Allows online disk add/remove with automatic rebalancing.
- Direct NFS (dNFS)
- Optimizes I/O when datafiles are on NFS mounts.
- Bypasses the OS NFS client for better performance and load balancing.
- Distributes I/O requests across multiple network paths.
- ASM Cluster File System (ACFS)
- Extends ASM to manage general-purpose files alongside database storage.
- Provides a unified storage layer accessible across RAC nodes.
- Ideal for application binaries and shared files.
- RMAN and Storage Snapshots
- Integrates with storage arrays to create hardware-level snapshots.
- Performs backups quickly with minimal database impact.
- Snapshots can be cataloged for recovery or used to clone databases.
File Mapping and FMON
In earlier releases, Oracle provided a file mapping mechanism to relate logical database structures with underlying storage. This was managed by the FMON background process when the
FILE_MAPPING parameter was set to TRUE. FMON was responsible for:
- Building mapping information (files, extents, elements, subelements) in the SGA.
- Refreshing mappings when datafiles changed in size, were added, or removed.
- Persisting mapping details in the data dictionary for consistency across restarts.
- Restoring mapping information at instance startup to avoid full rebuilds.
These mappings were accessible through dictionary views and controllable via the
DBMS_STORAGE_MAP package. While still available, this approach is largely replaced by ASM and related modern storage technologies.