Oracle Database Out-of-Memory (OOM) Error:
Table of Contents
ORA-00471 Due to Insufficient Linux Swap Space – Root Cause, Resolution, and Prevention
Swap space is an area on disk that Linux uses as virtual memory when physical RAM becomes insufficient. It allows the operating system to temporarily move inactive memory pages from RAM to disk, freeing physical memory for active processes.
Although swap extends the amount of available memory, it is significantly slower than RAM because it relies on disk I/O. Therefore, swap should be considered a safety mechanism rather than additional system memory.
Relationship Between RAM and Swap
The appropriate swap size depends on several factors, including:
- Total physical memory (RAM)
- Oracle database workload
- Number of concurrent users
- Oracle SGA and PGA configuration
- Other applications running on the server
- Operating system recommendations
This article explains the Oracle OOM error, its root cause, how to diagnose it, the solution, and best practices to prevent future occurrences.
Oracle Database OOM Error Overview
Symptoms
An Oracle Database instance suddenly becomes unavailable, and applications lose database connectivity.
The Oracle Alert Log typically reports:
ORA-00471: DBWR process terminated with error
PMON (ospid: xxxx): terminating the instance due to error 471
Instance terminated by PMON
At the operating system level, Linux records an Out-of-Memory event.
Example:
ora_m006_xe invoked oom-killer:
gfp_mask=0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), order=0, oom_score_adj=0
Why Does ORA-00471 Occur During an OOM Event?
Oracle background processes such as:
- DBWR (Database Writer)
- LGWR
- CKPT
- PMON
- SMON
are essential for database operation.
When Linux exhausts both:
- Physical Memory (RAM)
- Swap Space
the Linux OOM Killer forcibly terminates one or more processes to recover memory.
If an Oracle background process is selected, Oracle detects the unexpected process termination and immediately shuts down the database instance to protect database consistency.
This results in:
- ORA-00471
- PMON terminating the instance
- Database outage
- Application disconnections
Root Cause
The primary cause was insufficient swap space configured on the Linux server.
Initial configuration:
- Physical Memory: 62 GB
- Swap Space: 1 GB
During peak memory usage:
- RAM became fully utilized.
- Swap space reached 100% utilization.
- Linux invoked the OOM Killer.
- Oracle background process ora_m006_xe was terminated.
- DBWR failed.
- PMON terminated the Oracle instance.
How to Diagnose Oracle OOM Errors – Temporary Solution
Step 1: Check Linux OOM Logs
Run:
dmesg | grep -i “killed process\|oom\|out of memory”
Typical output:
ora_m006_xe invoked oom-killer
If Oracle processes appear in the output, Linux has terminated them due to memory exhaustion.
Step 2: Verify Swap Usage
Check configured swap:
swapon –show
Example:
NAME TYPE SIZE USED
/home/swap_dontdelete file 1024M 1024M
Observation:
- Swap Size: 1 GB
- Swap Used: 100%
This confirms complete swap exhaustion.
Step 3: Check Available Disk Space
Before increasing swap, verify available storage:
df -h
Ensure sufficient free space exists to create a larger swap file.
Step 4: Verify Memory Utilization
free -h
Look for:
- Low free memory
- High swap usage
- Memory pressure
Solution: Increase Linux Swap Space
Increasing swap provides additional virtual memory, reducing the likelihood that Linux will invoke the OOM Killer during temporary memory spikes.
Disable Existing Swap
sudo swapoff /swap_file
Remove Old Swap File
sudo rm -f /swap_file
Create a New 8 GB Swap File
sudo fallocate -l 8G /swap_file
Secure the Swap File
sudo chmod 600 /swap_file
Initialize the Swap Area
sudo mkswap /swap_file
Enable the New Swap
sudo swapon /swap_file
Verify the Configuration
Check Swap
swapon –show
Expected output:
NAME TYPE SIZE USED
/swap_file file 8G 0B
Verify Memory
free -h
Example:
total used free
Mem: 62Gi 44Gi 17Gi
Swap: 8.0Gi 0B 8.0Gi
The new swap space is available and unused under normal operating conditions.
Result After Resolution
Following the swap increase:
- Oracle database remained stable.
- No additional OOM Killer events were observed.
- Database services continued normally.
- Applications successfully reconnected.
- Adequate virtual memory became available during peak workloads.
Best Practices to Prevent Oracle OOM Errors
To minimize the risk of future Out-of-Memory incidents:
- Monitor physical memory usage continuously.
- Track swap utilization and configure alerts for high consumption.
- Review Oracle SGA and PGA memory settings periodically.
- Allocate sufficient swap space based on Oracle and Linux recommendations.
- Regularly examine Linux kernel logs (dmesg) for OOM events.
- Monitor Oracle Alert Logs for background process failures.
- Perform routine operating system and database health checks.
- Identify memory-intensive queries and optimize application workloads.
Frequently Asked Questions (FAQ)
What is ORA-00471?
ORA-00471 indicates that the Oracle Database Writer (DBWR) process terminated unexpectedly. Oracle shuts down the database instance to maintain data integrity.
Why does Linux kill Oracle processes?
When both physical RAM and swap space are exhausted, the Linux Out-of-Memory (OOM) Killer terminates processes to free memory. Oracle background processes can be selected if they consume significant memory.
Can increasing swap solve ORA-00471?
Increasing swap can prevent OOM-related process termination caused by temporary memory shortages. However, if the server consistently experiences memory pressure, additional RAM or Oracle memory tuning (such as optimizing SGA and PGA settings) may also be necessary.
How do I check whether Linux triggered the OOM Killer?
Run:
dmesg | grep -i “killed process\|oom\|out of memory”
If Oracle processes appear in the output, Linux terminated them because of insufficient memory.
How much swap should Oracle servers have?
The appropriate swap size depends on the server’s RAM, Oracle workload, and operating system guidelines. Production Oracle servers should have enough swap to accommodate memory spikes while avoiding excessive reliance on swap as a substitute for physical RAM.
Conclusion
An Oracle Database instance may terminate unexpectedly if the Linux operating system exhausts both physical memory and swap space. In this scenario, the Linux OOM Killer terminated an Oracle background process, triggering ORA-00471 and causing the PMON process to shut down the database instance.
By increasing the Linux swap space from 1 GB to 8 GB, the system regained adequate virtual memory capacity, eliminating the immediate cause of the OOM condition. Combined with ongoing monitoring of memory usage, Oracle memory configuration, and system logs, this approach helps maintain database stability and reduces the likelihood of future OOM-related outages.