Databases 6 min read

How Oracle Uses Cache, Buffer, and Write‑Back to Keep Data Consistent

The article explains the differences between cache and buffer, how Oracle’s log buffer and data buffer cache interact with various storage‑level caches, and why write‑back, battery‑backed caches, RAID and disk cache settings are crucial for maintaining data consistency during power loss.

ITPUB
ITPUB
ITPUB
How Oracle Uses Cache, Buffer, and Write‑Back to Keep Data Consistent

Cache vs. Buffer : In computing, a cache accelerates read operations by storing data fetched from disk, while a buffer temporarily holds data awaiting write to disk. The terms are often blended as “buffer cache,” which this article treats uniformly as cache.

Oracle’s Internal Caches

Oracle uses a log buffer to handle redo writes and a data buffer cache for reading and writing data blocks. If an I/O request misses the SGA, a physical I/O occurs, but Oracle is agnostic about the underlying storage—whether it is a file system, raw device, ASM, RAID, etc.

Ubiquitous Storage Caches

Every layer of the storage stack contains caches: file‑system cache, storage‑array cache, RAID controller cache, and even disk‑internal cache. Oracle’s write may complete in a storage cache before the data reaches the physical medium.

Write‑Ahead Logging and Direct I/O

Oracle’s key durability feature is Write‑Ahead Logging (WAL) : before a data block is written, the redo log must be persisted. Oracle forces redo writes through direct I/O, bypassing the OS file‑system cache, yet the data can still reside in the storage‑array cache.

Write‑Back vs. Write‑Through

Most storage devices employ write‑back caching: the write is acknowledged once it lands in the cache, and a battery or capacitor backs the cache to flush data to disk after a power loss (typically within 30 minutes). When the cache is disabled, the device operates in write‑through mode, requiring the data to be written to the disk before the write returns, which reduces performance but improves safety. Storage systems may automatically switch to write‑through when a component fails.

RAID‑Card Cache

RAID controllers usually have a 256 MiB cache powered by a battery. Unlike storage‑array batteries, this battery only powers the cache to prevent data loss; it does not guarantee that cached data will be flushed to disk. Some RAID cards also include flash cache, which can retain data for days after power loss.

Disk‑Internal Cache and FUA

Disk drives typically contain 16–64 MiB of cache, often disabled by manufacturers to favor data reliability. The SCSI FUA (Force Unit Access) command forces a write to bypass the disk cache and complete on the medium, effectively implementing write‑through at the disk level.

Ensuring Consistency

Thus, a single Oracle physical I/O traverses multiple cache layers before reaching the disk. While caches boost performance, they introduce the need for power‑loss protection. Data consistency is ultimately guaranteed by the combined effort of Oracle’s WAL mechanism, the operating system, and the storage subsystem’s cache policies.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

CachedatabasestorageOracleWrite-Ahead Logging
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.