Organization of the Database Buffer Cache (80)

本文详细介绍了Oracle数据库缓存机制中的两种主要列表:写列表和最近最少使用(LRU)列表。写列表用于存放已修改但未写入磁盘的数据缓冲区;LRU列表则包含空闲、被固定及未转移至写列表的脏缓冲区。当用户进程请求数据时,Oracle会在缓存中搜索,若命中则直接从内存读取,否则从磁盘加载。

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
数据写入磁盘

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10599713/viewspace-978170/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10599713/viewspace-978170/

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值