Tuesday 26 June 2018

Overview to Oracle Process Architecture - Background Process Explained

What are the Background Processes that run in Oracle Server? What is their functionality?

Oracle Server uses multiple background processes which help in handling different processes simultaneously. These processes are capable of handling single user request or multiple user requests depending upon the environment need. These background processes are nothing but some consolidated functions which are handled by multiple database programs running for each and every user process. Background processes asynchronously perform I/O and monitor other Oracle Database processes to provide increased parallelism for better performance and reliability.

Following is the list of different background processes which help in performing oracle database server operations:



1. Database Writer (DBWn) - Database writer process in Oracle Architecture writes modified blocks from the database buffer cache to DB files (Datafiles). The maximum number of database writers which can be run simultaneously is 20 (DBW0-DBW9 and DBWa-DBWj). The DB_WRITER_PROCESSES initialization parameter specifies the number of DBWn processes. The database selects an appropriate default setting for this initialization parameter or adjusts a user-specified setting based on the number of CPUs and the number of processor groups.

2. Log writer (LGWR) - The task of Log Writer is to write Redo Log Buffers from the Redo Log Buffer Cache to Redo Log Files in the disk.  Redo log buffer contains the log of each and every single query that has been performed in the server by using System Global Area. SGA (System Global Area) holds the place for these Redo Log Buffers and also allows them to be modified when required. After the Redo Logs are written to the disk, Database writers performs its task.


3. Checkpoint (CKPT) - Checkpoint indicates the current state of Oracle Database Server. Oracle server, after particular set of time, look for the status of different buffers in SGA. At these specific times, all modified database buffers in the system global area are written to the datafiles by DBWn. This event is called a checkpoint. The checkpoint process is responsible for signalling DBWn at checkpoints and updating all the datafiles and control files of the database to indicate the most recent checkpoint.

4. System monitor (SMON) - The task of System Monitor Process is to perform recovery when required. This happens at the time of instance breakup when in needs to be restarted again. After the instance starts up again, recovery is made which is done by the System Monitor Process. In case of Oracle RAC (Real Application Clusters), one system monitor process (SMON) of one instance can also perform the recovery of another instance. 

                                   SMON also cleans up temporary segments that are no longer in use and recovers dead transactions skipped during system failure and instance recovery because of file-read or offline errors. These transactions are eventually recovered by SMON when the tablespace or file is brought back online.

5. Process monitor (PMON) - PMON takes care of the Server Processes and is enabled by default. When a user process tries to connect to database to make some transaction, a server process gets associated with it because a user process cannot directly communicate with the database, server process does the work for it. Now everything happening inside database runs in an orderly manner but there are chances when the order gets distorted. Let's say a power failure or instance crash are some scenarios where session gets terminated in an disorderly fashion leaving behind some incomplete work to be performed. Here the PMON plays the important role. If the session breaks while some transaction was active, PMON rollback the changes and brings the order back.

6. Archiver (ARCn) - Archiver process is not enabled by default i.e. you need to manually enable if by putting your database in Archivelog mode. In Archivelog mode, the copies of Redo Logs are kept for safekeeping and are helpful in database recovery scenarios. Archiver process helps in copying the Redo Logs and store them in the form of archives in FRA or any location specified by you.

7. Recoverer (RECO) - RECO or Recoverer process comes in play mostly in case of distributed transactions. A distributed transaction includes minimum of 2 database or can be more. The best example for the same is database links. Now when you perform commit, database saves your changes. Not on datafile (at the moment) but surely in Redo Logs and provides surety that your data is safe. In case of distributed transactions, it's a two phase COMMIT process, one inside your local database and one in remote. The commit in each database must be coordinated or there will be inconsistency. If anything goes wrong in this scenario, RECO cancels the commit operation and rollback the changes.

8. Manageability Monitoring Process (MMON) - MMON process helps in stats gathering. As it's names suggests, it watches what's happening inside database in terms of I/O usage, memory usage, CPU usage. Being said that it monitors the instance activity and keeps on updating data dictionary which further helps in performance tuning and improving the database performance.

Apart from the above mentioned process, there are some other process which are also the part of Oracle Process Architecture. Please read about them here.

I hope this helps !!

No comments:

Post a Comment