The database writer process (DBWn) writes the contents of buffers to datafiles. The
DBWn processes are responsible for writing modified (dirty) buffers in the database
buffer cache to disk. Although one database writer process (DBW0) is adequate for
most systems, you can configure additional processes (DBW1 through DBW9 and
DBWa through DBWj) to improve write performance if your system modifies data
heavily. These additional DBWn processes are not useful on uniprocessor systems.
When a buffer in the database buffer cache is modified, it is marked dirty. A cold
buffer is a buffer that has not been recently used according to the least recently used
(LRU) algorithm. The DBWn process writes cold, dirty buffers to disk so that user
processes are able to find cold, clean buffers that can be used to read new blocks into
the cache. As buffers are dirtied by user processes, the number of free buffers
diminishes. If the number of free buffers drops too low, user processes that must read
blocks from disk into the cache are not able to find free buffers. DBWn manages the
buffer cache so that user processes can always find free buffers.
By writing cold, dirty buffers to disk, DBWn improves the performance of finding free
buffers while keeping recently used buffers resident in memory. For example, blocks
that are part of frequently accessed small tables or indexes are kept in the cache so that
they do not need to be read in again from disk. The LRU algorithm keeps more
frequently accessed blocks in the buffer cache so that when a buffer is written to disk,
it is unlikely to contain data that will be useful soon.
The initialization parameter DB_WRITER_PROCESSES specifies the number of DBWn
processes. The maximum number of DBWn processes is 20. If it is not specified by the
user during startup, Oracle determines how to set DB_WRITER_PROCESSES based on
the number of CPUs and processor groups.
The DBWn process writes dirty buffers to disk under the following conditions:
■ When a server process cannot find a clean reusable buffer after scanning a
threshold number of buffers, it signals DBWn to write. DBWn writes dirty buffers
to disk asynchronously while performing other processing.
■ DBWn periodically writes buffers to advance the checkpoint, which is the position
in the redo thread (log) from which instance recovery begins. This log position is
determined by the oldest dirty buffer in the buffer cache.
In all cases, DBWn performs batched (multiblock) writes to improve efficiency. The
number of blocks written in a multiblock write varies by operating system.
2. DB_WRITER_PROCESSES参数指定DBWn进程的数目 , 最大数目为20 , 如果在启动时用户没有指定 , Oracle
3. 在以下情况 , 数据库写进程将脏缓冲区的数据写入磁盘
a. 当服务器进程扫描超过缓冲区的阀值还找不到clean reusable buffer
b. DBWn periodically writes buffers to advance the checkpoint
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/10599713/viewspace-979560/，如需转载，请注明出处，否则将追究法律责任。