Background Processes- Oracle Processes

The Oracle instance is made up of two things: the SGA and a set of background processes. The background processes perform the mundane maintenance tasks needed to keep the database running.

For example, there is a process that maintains the block buffer cache for us, writing blocks out to the datafiles as needed. Another process is responsible for copying an online redo log file to an archive destination as it fills up.

Yet another process is responsible for cleaning up after aborted processes and so on. Each of these processes is pretty focused on its job, but works in concert with all of the others.

For example, when the process responsible for writing to the log files fills one log and goes to the next, it will notify the process responsible for archiving that full log file that there is work to be done.

There is a V$ view you can use to see all of the possible Oracle background processes and determine which ones are in use in your system currently:

SQL> select paddr, name, description from v$bgprocess order by paddr desc;

PADDR NAME DESCRIPTION
0000000072FD44C8 MMON Manageability Monitor Process
00000000727FD850 MMNL Manageability Monitor Process 2
00000000723FE138 LREG Listener Registration

00000000723FCFD8 SMON System Monitor Process 00000000723F9BB8 CKPT checkpoint 00000000723F8A58 LGWR Redo etc. 00000000723F78F8 DBW0 db writer process 0
00 VMB0 Volume Membership 0
00 ACFS ACFS CSS
00 SCRB ASM Scrubbing Master
00 XDMG cell automation manager
00 XDWK cell automation worker actions

401 rows selected.

Rows in this view with a PADDR other than 00 are processes (threads) configured and running on your system.

Tip Another way to view currently running background processes is to query V$PROCESS where PNAME is not null.

There are two classes of background processes: those that have a focused job to do (as just described) and those that do a variety of other jobs (i.e., utility processes).

For example, there is a utility background process for the internal job queues accessible via the DBMS_JOB/DBMS_SCHEDULER packages.

This process monitors the job queues and runs whatever is inside them. In many respects, it resembles a dedicated server process, but without a client connection. Let’s examine each of these background processes, starting with the ones that have a focused job, and then look into the utility processes.

Focused Background Processes

The number, names, and types of focused background processes vary by release. Figure 5-4 depicts a typical set of Oracle background processes that have a focused purpose.

Figure 5-4.  Focused background processes

For example, here’s a database started using a minimum number of init.ora parameters:

$ sqlplus / as sysdba

SQL> create pfile=’/tmp/pfile’ from spfile; File created.
SQL> !cat /tmp/pfile

Here’s a snippet of the output:

*.audit_file_dest=’/opt/oracle/admin/CDB/adump’
*.audit_sys_operations=false
*.audit_trail=’none’
*.commit_logging=’batch’
*.commit_wait=’nowait’
*.compatible=’21.0.0′
*.control_files=’/opt/oracle/oradata/CDB/control01.ctl’,’/opt/oracle/oradata/CDB/control02.ctl’
*.db_block_size=8192
*.db_name=’CDB’

The number of background processes started will vary quite depending on the version of Oracle. In general, each new major release will have several more background processes than prior releases. For example, with the latest release of Oracle, you would have about 60 background processes started up:

SQL> select paddr, name, description from v$bgprocess where paddr <> ’00’ order by paddr desc;

000000007353FE60 SMON System Monitor Process
000000007353E900 LG00 Log Writer Slave
000000007353D3A0 CKPT checkpoint
000000007353BE40 LGWR Redo etc.
000000007353A8E0 DBW0 db writer process 0
0000000073539380 DIA0 diagnosibility process 0
0000000073537E20 PMAN process manager

Note that you may not see all of these processes when you start your instance, but the majority of them will be present. You will only see ARCn (the archiver) if you are in ARCHIVELOG mode and have enabled automatic archiving. You will only see the LMD0, LCKn, LMON, and LMSn (more details on those processes shortly) processes if you are running Oracle RAC, a configuration of Oracle that allows many instances on different machines in a cluster to mount and open the same physical database.

Note On some UNIX/Linux platforms, you can use a mixture of processes and threads. This feature is enabled by setting the initialization THREADED_EXECUTION parameter to TRUE (the default is FALSE). Nothing has fundamentally changed—all of the “processes” are still there; you just might not see them via the operating system ps command because they are now running as a thread in a larger process.

So, Figure 5-4 depicts roughly what you might see if you started an Oracle instance and mounted and opened a database. On an operating system where Oracle implements a multiprocess architecture, such as on a UNIX/Linux system, you can physically see these processes. After starting the instance, I observed the following:

$ ps -aef | grep ora_…._$ORACLE_SID | grep -v grep
oracle 24704 1 0 18:55 ? 00:00:00 ora_pmon_CDB
oracle 24706 1 0 18:55 ? 00:00:00 ora_clmn_CDB
oracle 24708 1 0 18:55 ? 00:00:00 ora_psp0_CDB
oracle 24711 1 0 18:55 ? 00:00:02 ora_vktm_CDB
oracle 24716 1 0 18:55 ? 00:00:00 ora_gen0_CDB
oracle 24718 1 0 18:55 ? 00:00:00 ora_mman_CDB
oracle 24722 1 0 18:55 ? 00:00:00 ora_gen1_CDB

It is interesting to note the naming convention used by these processes. The process name starts with ora_. It is followed by four characters representing the actual name of the process, which are followed by _CDB. As it happens, my ORACLE_SID (site identifier) is CDB.

On UNIX/Linux, this makes it very easy to identify the Oracle background processes and associate them with a particular instance (on Windows, there is no easy way to do this, as the backgrounds are threads in a larger, single process).

What is perhaps most interesting, but not readily apparent from the preceding code, is that they are all really the same exact binary executable program—there is not a separate executable for each “program.” Search as hard as you like, but you will not find the ora_pmon_CDB binary executable on disk anywhere.

You will not find ora_lgwr_CDB or ora_reco_CDB. These processes are all really oracle (that’s the name of the binary executable that is run). They just alias themselves upon startup to make it easier to identify which process is which.

This enables a great deal of object code to be efficiently shared on the UNIX/Linux platform. On Windows, this is not nearly as interesting, as they are just threads within the process, so of course they are one big binary.

Let’s now take a look at the function performed by each major process of interest, starting with the primary Oracle background processes. For a complete listing of the possible background processes and a short synopsis of the function they perform, I will direct you to the appendix of the Oracle Database Reference manual available freely on http://otn.oracle.com/.

Leave a Reply

Your email address will not be published. Required fields are marked *