Database Writer Process (DBWn)
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.

数据库写入进程将BUFFER中的数据内容写入到数据文件。DBWN进程负责写入数据库

BUFFER池中的脏的修改数据到磁盘。尽管一个写入进程DBW0适合于多数系统,你可以

配置额外进程(DBW1到DBW9和DBWA到DBWJ)以提高写入的性能如果你系统的写入量

很大的话。这些额外的DBWN进程对于单CPU的系统来说是没有用的。

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.

当数据库的BUFFER缓冲池的缓冲区被修改,它被标记为脏。一个冷BUFFER就是一个

通过LRU算法最近最少使用的缓冲池。DBWN进程写入冷的,脏的缓存到磁盘这样用户用户

进程可以发现冷的,干净缓冲池可以用于读入新块到缓冲池中。当BUFFER被用户进程

变为脏后,空闲缓冲区的大小变少。如果空闲的数量降得太氏了,用户进程那些需要从磁盘

读入到缓存将不能找到空闲缓存。DBWN管理BUFFER缓存以致于用户总是可以发现空闲的

缓存。

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.

通过写入冷,脏缓存到磁盘,DBWN提高了查找空闲缓存的性能当保存最近使用的缓冲在

内存的时候。比如,块是一个被经常访问的小表或索引的一部份保存在缓存以致于它们不

需要再次被读入从磁盘上。LRU算法保存频繁在BUFFER缓存中频繁访问的块。所以一个

缓存被写入磁盘时它不大可能是包含那些即将有用的数据。

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.

初始化参数DB_WRITER_PROCESSES指定了DBWN进程的数量。DBWN进程的最大数据是

20,它不是在启动时候被用户指定,ORACLE决定如何设置DB_WRITER_PROCESSES取决于

CPU的数量和处理器组的数量;

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进程写入脏数据到磁盘有以下几种条件:

#当一个服务进程不能找到一个干净可用的缓存通过扫描BUFFER的阀值后,它通知

DBWN写入,DBWN同步写入脏数据到磁盘当执行其它进程时候。

■ 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.

DBWN周期地写入缓存去推进检查点,它是在REDO日志进程中实例开始恢复的位置。这个

日志位置取决于在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.

在所有情况下,DBWN执行批量(多块)写入提高效率,块的数量写入在多块写入中的变化

取决于操作系统。