Oracle Background Processes

An Oracle instance runs two types of processes – Server and
Background. Server processes are created to handle requests from sessions
connected to the instance. Background processes, as the name says, are
processes running behind the scene and are meant to perform certain maintenance
activities or to deal with abnormal conditions arising in the lifetime of the
instance. We will discuss Background processes in detail here.

Not all background processes are mandatory for an instance.
Each background process is meant for a specific purpose and its role is well
defined. Background processes are visible as separate operating system processes
in Unix/Linux. In Windows, these run as separate threads within the same
process.

Background processes are invoked automatically when the
instance is started. Given below is a list of twenty background processes along
with their technical or internally referred names.

Database Writer

Process Name: DBW0 through DBW9 and DBWa through DBWj

Max Processes: 20

This process writes the dirty buffers present in the
database buffer cache to datafiles. The process does multi-block writing to
disk asynchronously. One database writer process is adequate for most systems; more
can be configured if necessary. The initialization parameter,
DB_WRITER_PROCESSES, specifies the number of database writer processes to
start.

The DBWn process writes dirty buffer to disk under the
following conditions:

1. When a checkpoint is issued. Please see checkpoint process below.

2. When a server process cannot find
a clean reusable buffer after scanning a threshold number of buffers.

3. Every 3 seconds. See Followup on DBWn DBWn 3 second write

Database writer must always be running for an instance.

Log Writer

Process Name: LGWR

Max Processes: 1

The log writer process writes data from the redo log buffers
to the redo log files on disk.

The writer is activated under the following conditions:

1. When a transaction is committed,
a System Change Number (SCN) is generated and tagged to it. Log writer puts a
commit record in the redo log buffer and writes it to disk immediately along
with the transaction’s redo entries. Changes to actual data blocks are deferred
until a convenient time (Fast-Commit Mechanism).

2. Every 3 seconds.

3. When the redo log buffer is 1/3
full.

4. When DBWn signals the writing of
redo records to disk. All redo records associated with changes in the block
buffers must be written to disk first (The write-ahead protocol). While writing
dirty buffers, if the DBWn process finds that some redo information has not
been written, it signals the LGWR to write the information and waits until the
control is returned.

Log writer will write synchronously to the redo log groups
in a circular fashion. If any damage is identified with a redo log file, the
log writer will log an error in the LGWR trace file and the system Alert Log.
Sometimes, when additional redo log buffer space is required, the LGWR will
even write uncommitted redo log entries to release the held buffers. LGWR can
also use group commits (multiple committed transaction’s redo entries taken
together) to write to redo logs when a database is undergoing heavy write
operations.

The log writer must always be running for an instance.

Archiver

Process Name: ARC0 through ARC9

Max Processes: 10

The ARCn process is responsible for writing the online redo
log files to the mentioned archive log destination after a log switch has
occurred. ARCn is present only if the database is running in archivelog mode
and automatic archiving is enabled. The log writer process is responsible for
starting multiple ARCn processes when the workload increases. Unless ARCn
completes the copying of a redo log file, it is not released to log writer for
overwriting.

The number of Archiver processes that can be invoked
initially is specified by the initialization parameter
LOG_ARCHIVE_MAX_PROCESSES. The actual number of Archiver processes in use may
vary based on the workload.

Latest Articles