Background Processes in Oracle
Background Processes in Oracle
Background Processes in Oracle
Not all background processes are mandatory for an instance. Some are mandatory and
some are optional. Mandatory background processes are DBWn, LGWR, CKPT, SMON,
PMON, and RECO. All other processes are optional, will be invoked if that particular
feature is activated.
The possible multiple DBWR processes in RAC must be coordinated through the locking
and global cache processes to ensure efficient processing is accomplished.
2) Log Writer (maximum 1) LGWR
LGWR writes redo data from redolog buffers to (online) redolog files, sequentially.
Redolog file contains changes to any datafile. The content of the redolog file is file id,
block id and new content.
LGWR will be invoked more often than DBWn as log files are really small when
compared to datafiles (KB vs GB). For every small update we don’t want to open huge
gigabytes of datafiles, instead write to the log file.
Redolog file has three stages CURRENT, ACTIVE, INACTIVE and this is a cyclic process.
Newly created redolog file will be in UNUSED state.
When the LGWR is writing to a particular redolog file, that file is said to be in CURRENT
status. If the file is filled up completely then a log switch takes place and the LGWR
starts writing to the second file (this is the reason every database requires a minimum
of 2 redolog groups). The file which is filled up now becomes from CURRENT to
ACTIVE.
Log writer will write synchronously to the redolog groups in a circular fashion. If any
damage is identified with a redolog file, the log writer will log an error in the LGWR
trace file and the alert log. Sometimes, when additional redolog buffer space is
required, the LGWR will even write uncommitted redolog entries to release the held
buffers. LGWR can also use group commits (multiple committed transaction's redo
entries taken together) to write to redologs when a database is undergoing heavy write
operations.
In RAC, each RAC instance has its own LGWR process that maintains that instance’s
thread of redo logs.
3) Checkpoint (maximum 1) CKPT
Checkpoint is a background process which triggers the checkpoint event, to
synchronize all database files with the checkpoint information. It ensures data
consistency and faster database recovery in case of a crash.
When checkpoint occurred it will invoke the DBWn and updates the SCN block of the all
datafiles and the control file with the current SCN. This is done by LGWR. This SCN is
called checkpoint SCN.
Checkpoint event can be occurred in following conditions:
o Whenever database buffer cache filled up.
o Whenever times out (3seconds until 9i, 1second from 10g).
o Log switch occurred.
o Whenever manual log switch is done.
SQL> ALTER SYSTEM SWITCH LOGFILE;
o Manual checkpoint.
SQL> ALTER SYSTEM CHECKPOINT;
o Graceful shutdown of the database.
o Whenever BEGIN BACKUP command is issued.
o When the time specified by the initialization parameter
LOG_CHECKPOINT_TIMEOUT (in seconds), exists between the incremental checkpoint
and the tail of the log.
o When the number of OS blocks specified by the initialization parameter
LOG_CHECKPOINT_INTERVAL, exists between the incremental checkpoint and the tail
of the log.
o The number of buffers specified by the initialization parameter
FAST_START_IO_TARGET required to perform roll-forward is reached.
o Oracle 9i onwards, the time specified by the initialization parameter
FAST_START_MTTR_TARGET (in seconds) is reached and specifies the time required
for a crash recovery. The parameter FAST_START_MTTR_TARGET replaces
LOG_CHECKPOINT_INTERVAL and FAST_START_IO_TARGET, but these parameters
can still be used.
If a client has an open transaction which is no longer active (client session is closed)
then PMON comes into the picture and that transaction becomes in doubt transaction
which will be rolled back.
PMON is responsible for performing recovery if a user process fails. It will rollback
uncommitted transactions. If the old session locked any resources that will be unlocked
by PMON.
PMON is responsible for cleaning up the database buffer cache and freeing resources
that were allocated to a process.
PMON also registers information about the instance and dispatcher processes with
Oracle (network) listener.
PMON also checks the dispatcher & server processes and restarts them if they have
failed.
The number of archiver processes that can be invoked initially is specified by the
initialization parameter LOG_ARCHIVE_MAX_PROCESSES (by default 2, max 10). The
actual number of archiver processes in use may vary based on the workload.
ARCH processes, running on primary database, select archived redo logs and send
them to standby database. Archive log files are used for media recovery (in case of a
hard disk failure and for maintaining an Oracle standby database via log shipping).
Archives the standby redo logs applied by the managed recovery process (MRP).
In RAC, the various ARCH processes can be utilized to ensure that copies of the
archived redo logs for each instance are available to the other instances in the RAC
setup should they be needed for recovery.
This is the Oracle’s dynamic job queue coordinator. It periodically selects jobs (from
JOB$) that need to be run, scheduled by the Oracle job queue. The coordinator process
dynamically spawns job queue slave processes (J000-J999) to run the jobs. These jobs
could be PL/SQL statements or procedures on an Oracle instance.
CQJ0 - Job queue controller process wakes up periodically and checks the job log. If a
job is due, it spawns Jnnnn processes to handle jobs.
Dedicated Server
Dedicated server processes are used when MTS is not used. Each user process gets a
dedicated connection to the database. These user processes also handle disk reads
from database datafiles into the database block buffers.
LISTENER
The LISTENER process listens for connection requests on a specified port and passes
these requests to either a distributor process if MTS is configured, or to a dedicated
process if MTS is not used. The LISTENER process is responsible for load balance and
failover in case a RAC instance fails or is overloaded.
CALLOUT Listener
Used by internal processes to make calls to externally stored procedures.
DRCn
These network receiver processes establish the connection from the source database
NSVn process. When the broker needs to send something (e.g. data or SQL) between
databases, it uses this NSV to DRC connection. These connections are started as
needed.
In Data Guard, LNS process performs actual network I/O and waits for each network
I/O to complete. Each LNS has a user configurable buffer that is used to accept
outbound redo data from the LGWR process. The NET_TIMEOUT attribute is used only
when the LGWR process transmits redo data using a LGWR Network Server(LNS)
process.
Shadow Process
When client logs in to an Oracle Server the database creates and Oracle process to
service Data Pump API.
Client Process
The client process calls the Data pump API.
ASMB
This ASMB process is used to provide information to and from cluster synchronization
services used by ASM to manage the disk resources. It's also used to
update statistics and provide a heart beat mechanism.
Re-Balance RBAL
RBAL is the ASM related process that performs rebalancing of disk resources controlled
by ASM.
Actual Rebalance ARBx
ARBx is configured by ASM_POWER_LIMIT.