Inside the Oracle Instance: Memory Structures & Background Processes

if you missed the previous post on Oracle Database Architecture, check it out here to get the full context before diving into this one.

Please subscribe and follow for more.

In this post, we’ll explore what happens inside the instance — from memory structures to some background processes that keep Oracle running smoothly.

The instance comprises memory and background processes.

The memory structure

SGA(Shared Global Area) - Shared by all sessions

PGA(Program Global Area)- Private to each user process

Memory Structures in Oracle

The SGA is further broken down to different memory components: Shared pool, buffer pool, redo log buffer and large pool.

ComponentDescription
Shared PoolParses and stores SQL and PL/SQL execution info, data dictionary, and system parameters.
Buffer CacheStores copies of frequently accessed data blocks from datafiles. Managed by LRU (Least Recently Used) algorithm.
Redo Log BufferTemporarily holds changes made to the database before LGWR (Log Writer) writes them to redo log files.
Large PoolUsed for large memory operations like parallel SQL execution, RMAN I/O slaves. Used to allocate memory too large for the shared pool.

PGA(Program Global Area)

Memory allocated to individual server process

Usually used for handling PL/SQL executions, sorts and hash joins.

Key Background processes

There are several background processes but we will touch just the vital few.

LGWR (Log Writer)

Writes changes from the redo buffers to the redo log files and it is also responsible for switching between redo log files.

It is triggered when the redo buffer is one-third full, when user commits changes and after 3 second, whichever comes first.

DBWR (Database Writer)

The database writer process is responsible for writing dirty buffers from buffer cache to disk.

It writes the changes made on the database to the datafiles on disk.

Ckpt (Checkpoint Process)

It is triggered during a redo log switch.

This process writes scn to the datafile headers and control file to ensure changes are permanently recorded and known to the database.

Relationship Between LGWR, DBWR and CKPT

Basically, when a redo log switch happens, a new scn is generated and the status of old redo log file changes from current to active then the status of the new redo log file the lgwr switches to becomes current.

This triggers checkpoint process so that it signals dbwr to write dirty buffers from buffer cache to their corresponding datafiles on disk.

Once this is completed, checkpoint process then updates the datafile headers and control file with the new scn marking a consistent state of the database for recovery.

Summary

SCN is generated→Old redo logCURRENTACTIVENew redo log → becomes CURRENTCKPT signals→DBWR to write dirty buffers→CKPT updates datafile headers & control file with new SCN

0
Subscribe to my newsletter

Read articles from Olamigoke Oyeneyin directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Olamigoke Oyeneyin
Olamigoke Oyeneyin

An experienced database administrator that loves exploring.