一.Background Processes
To maximize performance and accommodate many users, a multiprocess Oracle system uses some additional Oracle processes called background processes .
后臺進程定義:為了最大的性能和容納更多的用戶,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
官方文檔關于dbwn的說明
Database Writer Process (DBW n )
The database writer process (DBWn) writes the contents of buffers to datafiles. The DBW n 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 DBW n 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 DBW n 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. DBW n manages the buffer cache so that user processes can always find free buffers.
在數據庫高速緩存中當有一個緩存被修改,它就變成了臟數據了。一個冷緩存就是最近沒有被訪問的緩存塊。dbwn進程寫冷塊,臟緩存到硬盤,所以用戶進程能夠找到冷塊,清除緩,能把新的塊讀進緩存中去。緩存被用戶進程變臟,空閑緩存的數量就變少了。如果空閑的緩存下降的太少了,如果緩存不能找到空閑的塊用戶進程就必須從硬盤中讀塊。dbwn管理著高速緩存是為了讓用戶進程總能找到空閑的緩存。
By writing cold, dirty buffers to disk, DBW n 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提高找到空閑的性能。比如,頻繁的訪問一個小表和索引放在緩存中,是為了他們不需要再次的從硬盤中讀取數量。在高速緩存中用最近最少使用算法保存著頻繁訪問的塊,為了當一個緩存被寫到硬盤,不太可能和數據可能被很快就使用。
The initialization parameter
DB_WRITER_PROCESSES
specifies the number of DBW
n
processes. The maximum number of DBW
n
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會以cpu的數量和進程組來確定db_writer_processes的數量。
The DBW n process writes dirty buffers to disk under the following conditions:
dbwn進程寫臟數據到硬盤在下面的幾種情況:
-
When a server process cannot find a clean reusable buffer after scanning a threshold number of buffers, it signals DBW n to write. DBW n writes dirty buffers to disk asynchronously while performing other processing.
-
-
DBW n 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定期的寫緩存數據,為了使檢查點向前。在高速緩存中重做位置是由最后臟緩存決定的。
四、LGWR
LGWR(日志寫入程序)進程負責把聯機重做日志緩沖區的內容寫入聯機重做日志文件。
觸發LGWR的條件:
A commit record when a user process commits a transaction
當用戶進程提交一個事務Redo log buffers
Every three seconds超過三分鐘
When the redo log buffer is one-third full
當重寫緩存達到三分之一時.
When a DBW n process writes modified buffers to disk, if necessary
當dbwn進程寫臟緩存到硬盤.
The log writer process (LGWR) is responsible for redo log buffer management—writing the redo log buffer to a redo log file on disk. LGWR writes all redo entries that have been copied into the buffer since the last time it wrote.
LGWR對重做日志緩存負責-------寫重做日志緩存到重做日志文件中.LGWR寫所有的重做記錄,是為了在最后把緩存里的東西復制出來.
The redo log buffer is a circular buffer. When LGWR writes redo entries from the redo log buffer to a redo log file, server processes can then copy new entries over the entries in the redo log buffer that have been written to disk. LGWR normally writes fast enough to ensure that space is always available in the buffer for new entries, even when access to the redo log is heavy.
重做日志緩存區是一循環的緩存區.當LGWR把重做記錄從重做日志緩存區寫到重做日志文件中.在重做日志緩存服務進程能把新的記錄復制到這個記錄上,舊的記錄被寫到硬盤上.
LGWR一般都快速的寫以確保在緩存中對于新存的記錄能有空閑的空間可以使用,即使當redo log很忙.
LGWR writes synchronously to the active mirrored group of redo log files. If one of the files in the group is damaged or unavailable, LGWR continues writing to other files in the group and logs an error in the LGWR trace file and in the system alert log. If all files in a group are damaged, or the group is unavailable because it has not been archived, LGWR cannot continue to function.
LGWR同步的寫活動反映到重做日志文件的組中.如果在一個組里只有一個文件是的危害的和不可用的.在組LGWR繼續寫其它文件和日志在LGWR跟蹤文件中有是有錯誤的,在系統的警告日志.如果所有的文件在一個組里是危險的.或組不可用的因為因為他不能被存檔,LGWR功能不能被繼續使用.
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
