Learn about database writer and archive functions.
DBWR | ARCH Process
The database writer is a mandatory process. It writes data blocks from the
data buffer cache to the data files. DBWR works using a Least Recently Used (LRU) chain. This means that when you commit a transaction, the data is not automatically written to disk. It may be stored in the data buffer cache memory waiting to be written to disk during a system failure. Certain operating systems (such as Unix) allow you to start multiple database writers. This lets you flush more data out to disk faster. If possible, I always set the db_writers parameter at two (2) per datafile. Pictorially, it looks like this.
As mentioned earlier, ARCH is an optional process. This process is created when you operate with automatic archiving enabled. When ARCH is enabled, it copies the redo log entries from the online redo log files to an archive log area.
This process is almost mandatory if you have databases operating 24 x 7.
When the LGWR process switches from one Redo Log file to another, the ARCH process is initiated and copies the last unarchived redo log file. The location for the archive log files is defined in init.ora by the LOG_ARCHIVE_DEST parameter. We will discuss the archive process in greater detail later. The LGWR process will check to make sure that a redo log file was archived before it reuses the log file. The archive process is diagrammed below.
How do the DBWR and ARCH processes work together in Oracle?
The DBWR (Database Writer) and ARCH (Archiver) processes are two critical background processes in an Oracle database instance that work together to manage the data and redo logs of the database.
The DBWR process is responsible for writing data blocks from the database buffer cache to disk. When changes are made to the database, the data blocks are updated in the buffer cache and marked as dirty. The DBWR process periodically writes the dirty blocks from the buffer cache to disk, so that the changes can be persisted to disk.
The ARCH process, on the other hand, is responsible for writing redo log data to disk. The redo log data contains information about the changes made to the database, and is used to recover the database in the event of a failure. The ARCH process continually writes the redo log data to disk, so that it can be used to recover the database.
The DBWR and ARCH processes work together to ensure that the database is protected and can be recovered in the event of a failure. When changes are made to the database, the data blocks are updated in the buffer cache and the redo log data is generated. The DBWR process writes the dirty blocks from the buffer cache to disk, and the ARCH process writes the redo log data to disk. In this way, the two processes ensure that both the data and the redo logs are written to disk in a timely manner, so that the database can be recovered in the event of a failure.
It is important to monitor the DBWR and ARCH processes to ensure that they are running correctly and that the data and redo logs are being written to disk in a timely manner. The configuration of the DBWR and ARCH processes may also need to be adjusted based on the specific needs of the database and the system, to ensure that they are running efficiently and effectively.