The Oracle database system uses several background processes to perform various tasks and manage the database efficiently. Here are the details of the most important background processes:
PMON (Process Monitor):
PMON is responsible for process monitoring and process recovery. It cleans up failed processes, releases resources associated with them, and performs process recovery in case of process failures. It also maintains the list of active processes and frees up resources held by terminated or failed processes.
SMON (System Monitor):
SMON is responsible for system-level recovery, instance startup, and instance shutdown. It performs crash recovery during database startup to ensure the database is in a consistent state. SMON also coalesces free space in data blocks and deallocates temporary segments, among other tasks.
DBWn (Database Writer):db_writer_processses
·Writes modified data blocks from the database buffer cache to the data files on disk.
·Scans the buffer cache and identifies dirty (modified) blocks.
·Writes dirty blocks to their respective data files, using multi-block writes to optimize disk I/O.
·Uses a write-ahead algorithm to ensure data changes are persisted to disk before commit.
·Implements the least-recently-used (LRU) algorithm to manage the buffer cache and make room for new data blocks.
- Free Buffer Scans
- User Process Request
- Log Writer (LGWR) Request
- Full Buffer Cache
- Database Shutdown
CKPT (Checkpoint Process):
·Initiates the checkpoint process to synchronize the database buffers with data files.
·Signals DBWn to write dirty blocks to data files and update the control file and data file headers.
·Updates the control file to record the latest checkpoint position.
·Ensures that all changes made up to the checkpoint are recoverable in case of a system failure.
·Helps in reducing the time required for database recovery.
- Automatic Checkpoints, LOG_CHECKPOINT_INTERVAL and FAST_START_MTTR_TARGET.
- Database Shutdown
- manual CHECKPOINT
- Tablespace or Data File Offline/Online Operations
- Log Switch
- Database Recovery
LGWR (Log Writer):
·Writes redo log entries from the redo log buffer to the redo log files on disk.
·Copies redo log entries generated by user transactions and background processes to the redo log buffer.
·Writes redo log entries sequentially to redo log files in a circular fashion.
·Uses the write-ahead logging (WAL) technique to ensure transaction durability.
·Writes redo log entries in a timely manner to minimize the risk of data loss during a system failure.
·Coordinates with the checkpoint process (CKPT) to perform consistent database recovery.
When does lgwr occures:
- When a user transaction commits,
- When a checkpoint occurs,
- During a log switch
- During instance recovery or media recovery operations,