分类: Oracle
2013-02-04 09:45:56
后台进程定义:为了最大的性能和容纳更多的用户,oracle使用额外的进程被叫做后台进程处理。
一、后台进程主要包括:
Database Writer Process(DBWn)
Log Writer Process(LGWR)
CheckPoint Process(CKPT)
System Monitor Process(SMON)
Process Monitor Process(PMON)
Recoverer Process(RECO)
Job Queue Processes
Archiver Processes(ARCn)
Queue Monitor Processes (QMNn)
Other Background Processes
二、DBWR
在什么触发dbwr进程的条件:
1.当脏缓冲区的数量超过了所设定的限额。
2.当所设定的时间间隔到了。
3.当有进程需要数据库高速缓冲区却找不到空闲的缓冲区时。
4.当校验点发生时。
5.当某个表被删除或被截断时。
6.当某个表空间被设置为只读状态时。
7.当使用类似于alter tablespace users begin backup的命令对某个表空间进行联机备份时。
8.当某个临时表空间被设置为只脱机状态或正常状态时。
可通过设置DB_WRITER_PROCESSES的参数来让多个DBWR来进行写操作
1.show parameter db_writer_processes
2.alter system set db_writer_processes=9 scope=spfile(网有说是最多10个dbwr同时进行写操作,但是官方的文档上说有20个,本人没有测试过)
3.shutdown immediate
4.startup
本文转自cuug官网
官方文档关于dbwn的说明
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.
数据库的dbwn进程主要是把缓存的内容写到数据文件中。dbwn进程主要负责把数据库的高速缓存中的脏数据写到硬盘上。虽然一个dbwn进程能够满足大部分的系统,如果你的系统脏数据太多,你也可以配置(dbw1到dbw9或dbwa到dbwj)来改善写性能。在单进程的系统上增加dbwn进程没有用。
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.
在数据库高速缓存中当有一个缓存被修改,它就变成了脏数据了。一个冷缓存就是最近没有被访问的缓存块。dbwn进程写冷块,脏缓存到硬盘,所以用户进程能够找到冷块,清除缓,能把新的块读进缓存中去。缓存被用户进程变脏,空闲缓存的数量就变少了。如果空闲的缓存下降的太少了,如果缓存不能找到空闲的块用户进程就必须从硬盘中读块。dbwn管理着高速缓存是为了让用户进程总能找到空闲的缓存。