Oracle Background Processes
Oracle Background Processes
Oracle Background Processes
We have noted that you can conceptualize Oracle as a large computer program, but in reality,
Oracle is a collection of many programs called “background processes”, with each program
assigned to a specific job. The Oracle database can have a lot of processes running, depending
on how you have configured your database. There are two different kinds of background
processes associated with Oracle, required processes and optional processes. Let’s look at these
processes in a bit more detail.
* SMON - System Monitor process recovers after instance failure and monitors temporary
segments and extents. SMON in a non-failed instance can also perform failed instance recovery
for other failed RAC instance.
* PMON - Process Monitor process recovers failed process resources. If MTS (also called
Shared Server Architecture) is being utilized, PMON monitors and restarts any failed dispatcher
or server processes. In RAC, PMON’s role as service registration agent is particularly important.
* DBWR - Database Writer or Dirty Buffer Writer process is responsible for writing dirty
buffers from the database block cache to the database data files. Generally, DBWR only writes
blocks back to the data files on commit, or when the cache is full and space has to be made for
more blocks. The possible multiple DBWR processes in RAC must be coordinated through the
locking and global cache processes to ensure efficient processing is accomplished.
* LGWR - Log Writer process is responsible for writing the log buffers out to the redo logs. In
RAC, each RAC instance has its own LGWR process that maintains that instance’s thread of
redo logs.
* ARCH – The optional Archive process writes filled redo logs to the archive log location(s). 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.
We discussed the redo log buffer earlier in this chapter, and how its contents are transferred to
disk regularly. The Log Writer Process (LGWR) is responsible for the movement of this redo.
Like all the other “slave” programs, the LGWR process is started when the database is started,
and shutdown when the database is shutdown. On regular intervals LGWR will move the redo
from the redo log buffer to files on disk designed to store the redo called online redo log files.
We will discuss the online redo logs later in this chapter.
The Database Writer Process
The Database Writer (DBWR) process is responsible for writing data from the RAM buffer
cache to the database datafiles on disk. The database datafiles are physical files on disk (i.e.
customer.dbf). The default is to have one database writer process, but large databases can have
multiple DBWR processes.
The checkpoint process is responsible for updating file headers in the database datafiles. A
checkpoint occurs when Oracle moves new or updated blocks (called dirty blocks) from the
RAM buffer cache to the database datafiles. A checkpoint keeps the database buffer cache and
the database datafiles synchronized. This synchronization is part of the mechanism that Oracle
uses to ensure that your database can always be recovered.
The Process Monitor is the janitor of the database, cleaning-up trash left-over from aborted user
sessions (for instance, if a client abnormally disconnects from the database). If this should
happen, it is the job of the Process Monitor (PMON) process to cleanup after that failure. PMON
will cleanup memory areas and other database resources that were in use by that user process.
PMON constantly checks the status of user and database processes. In some cases, failed
database processes can be restarted by PMON.
When you startup your Oracle database, Oracle will perform several checks to see if the database
is healthy. SMON manages your database for you!
If Oracle finds a problem at startup time, the System Monitor process (SMON) will perform
recovery activities. SMON also performs certain types of database maintenance. These activities
occur in the background and have no real impact on normal database operations.
The Oracle database comes with a number of additional processes that are optional. For example,
Oracle comes with a program that allows you to schedule the times that certain database
programs will run. This program is known as the job scheduler process. The job scheduler is an
optional program that must be enabled for it to operate.
When the job scheduler is enabled, a process (program) will be started to control the job
scheduler. This is known as the Job Queue Process. Here are the most common optional
processes:
* Job Queue Process (CJQ) - Used for the job scheduler. The job scheduler includes a main
program (the coordinator) and slave programs that the coordinator executes. The parameter
job_queue_processes controls how many parallel job scheduler jobs can be executed at one time.
* Archiver Process (ARCn) - Used to archive online redo logs (which we discuss later in this
chapter) to disk. In cases when it is needed, Oracle Database 10g will start the ARCn process
automatically. If additional ARCn processes are needed, then the Oracle Database will start up to
9 additional processes.
* Queue Monitor Process (QMNn) - Used to manage Oracle Streams Advanced Queueing.
Now that we have learned about the basic Oracle background processes, let’s look at how they
all interface. As you can see from the picture below, the SGA is the main point of contact
between processes, providing shared RAM storage: