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.
Oracle Database Required Processes
Here are some of the most important Oracle background
processes:
* 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.
The Log Writer Process
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
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 Process
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.
The System Monitor Process
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.
Optional Oracle Background Processes
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.
* MMON, MMNL, MMAN - Used to perform various database
management tasks.
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:
Now, let?s wrap-up our architectural discussion by
looking at the data files where our information is stored.
This is an excerpt from the bestselling "Easy
Oracle Jumpstart" by Robert Freeman and Steve Karam (Oracle ACE and Oracle
Certified Master). It?s only $19.95 when you buy it directly from the
publisher
here.
|
If you like Oracle tuning, you may enjoy the new book "Oracle
Tuning: The Definitive Reference", over 900 pages of BC's favorite tuning
tips & scripts.
You can buy it direct from the publisher for 30%-off and get instant access to
the code depot of Oracle tuning scripts. |