Organization of the Database Buffer Cache (80)
The buffers in the cache are organized in two lists: the write list and the least recently
used (LRU) list. The write list holds dirty buffers, which contain data that has been
modified but has not yet been written to disk. The LRU list holds free buffers, pinned
buffers, and dirty buffers that have not yet been moved to the write list. Free buffers
do not contain any useful data and are available for use. Pinned buffers are currently
being accessed.
When an Oracle process accesses a buffer, the process moves the buffer to the most
recently used (MRU) end of the LRU list. As more buffers are continually moved to the
MRU end of the LRU list, dirty buffers age toward the LRU end of the LRU list.
The first time an Oracle user process requires a particular piece of data, it searches for
the data in the database buffer cache. If the process finds the data already in the cache
(a cache hit), it can read the data directly from memory. If the process cannot find the
data in the cache (a cache miss), it must copy the data block from a datafile on disk
into a buffer in the cache before accessing the data. Accessing data through a cache hit
is faster than data access through a cache miss.
Before reading a data block into the cache, the process must first find a free buffer. The
process searches the LRU list, starting at the least recently used end of the list. The
process searches either until it finds a free buffer or until it has searched the threshold
limit of buffers.
If the user process finds a dirty buffer as it searches the LRU list, it moves that buffer
to the write list and continues to search. When the process finds a free buffer, it reads
the data block from disk into the buffer and moves the buffer to the MRU end of the
LRU list.
If an Oracle user process searches the threshold limit of buffers without finding a free
buffer, the process stops searching the LRU list and signals the DBW0 background
process to write some of the dirty buffers to disk.
Database Buffer Cache結構
write list :髒列表 , 也就是被更改但還沒有寫入磁碟的資料 .
the least recently used (LRU) list :free buffers(無有用資料 , 可供使用), pinned buffers(正被訪問), 未轉移到write list的dirty buffers。
當Oracle訪問快取區 ,將該buffer移動到MRU .
當使用者程式請求一資料塊 , Oracle首先在database buffer cache查詢是否有該資料塊,如果找到 , 則稱為cache hit ,可以直接從記憶體中讀取 ,
如果沒有找到 ,則稱為cache miss, 這時候需要從磁碟上的資料檔案複製該資料塊到cache buffer後 , 才能訪問這些資料。
在讀取資料塊到cache之前 , 程式需要先從lru(從尾至頭)查詢一個free buffer, 要麼找到 ,要麼達到buffers閥值 .
如果找到一個dirty buffer , 把它移除到write list 並且繼續查詢 , 當找到free buffer後 ,程式將會從磁碟把資料塊讀入buffer ,
並且把buffer移到mru . 如果查詢達到buffer的閥值還沒有找到free buffer , 程式將停止查詢並且發出指令使dbw0後臺程式將dirty buffer
資料寫入磁碟
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10599713/viewspace-978170/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle database buffer cacheOracleDatabase
- Database Buffer Cache (79)Database
- Size of the Database Buffer Cache (82)Database
- database buffer cache之我見Database
- Buffer Cache 原理
- cache buffer chainAI
- How To Identify a Hot Block Within The Database Buffer Cache. [ID 163424.1]IDEBloCDatabase
- IO之核心buffer----"buffer cache"
- Buffer Cache Hit Ratio
- Oracle Buffer Cache原理Oracle
- CACHE BUFFER CHAINSAI
- page cache與buffer cache的關係
- Oracle Cache Buffer ChainsOracleAI
- linux cache and buffer【轉】Linux
- Latch: cache buffer chains (%)AI
- BUFFER CACHE尋找流程
- buffer cache logical structure!Struct
- buffer cache部分原理(LRU)
- oracle buffer cache管理機制_buffer cache dump與lru機制小記Oracle
- 【BUFFER】Oracle buffer cache之 latch 學習記錄Oracle
- 33、buffer_cache_3(redo的產生、LRBA、buffer cache裡的等待事件)事件
- buffer與cache的區別
- buffer cache基本知識點
- BUFFER CACHE 基礎知識
- [Oracle Script] Buffer Cache Hit RatioOracle
- 等待模擬-cache buffer chainAI
- Buffer cache的執行原理
- Buffer和Cache的區別
- Buffer 與 Cache 的區別
- Cache Buffer Chain Latch等待事件AI事件
- Cache 和 Buffer的區別
- why Buffer Cache Hit Ratio < 0
- buffer cache實驗5-latch:cache buffers chainAI
- 【Cache】將常用的“小表”快取到Buffer Cache快取
- Buffer Cache以及buffer busy waits/gc相關事件AIGC事件
- Linux Buffer/Cache 的區別Linux
- 轉_Buffer Cache的原理及使用
- buffer 與cache 的區別2