database buffer cache之我见

database buffer cache 通过db_cache_size和SGA_target来控制。

默认值:

If SGA_TARGET is set: If the parameter is not specified, then the default is 0 (internally determined by the Oracle Database). If the parameter is specified, then the user-specified value indicates a minimum value for the memory pool. If SGA_TARGET is not set, then the default is either 48 MB or 4 MB * number of CPUs, whichever is greater

如果sga_target被设置:
db_cache_szie是0,即数据库自动管理;db_cache_size非0,则就是database_buffer_cache的最小值
如果sga_target没被设置:
默认是48M或者是4M*cpu的数量,以较高的为准


数据库通过LRU算法控制db buffer cache的数据访问:

buffer touch counts

数据库会通过使用touch counts计算lru list中各数据缓冲访问的频繁度,这个机制确保当某个buffer被绑定的时候增加一个计数器,而不是不停地刷新lru list中的缓存。

当某个buffer被锁定,数据库会判断什么时候这个buffer的touch counts在最近是否增长了,如果3秒以前计数器增长了,那么计数器增加,否则就保持原样,三秒规则在计数很多touch的时候可以阻止pins的爆发增长,比如一个会话插入了几行数据,但数据库会认为这是一个touch。

如果一个buffer在lru的冷端,而touch count是高的,那么就会被该buffer就会被挪到热端,如果touch count是低的,那么就会被移出db buffer cache。


Every buffer has an access mode: pinned or free (unpinned). A buffer is "pinned" in the cache so that it does not age out of memory while a user session accesses it. Multiple sessions cannot modify a pinned buffer at the same time.

每个buffer都有一个访问模式:pinned或者是free。pinned的目的是为了防止用户会话访问时被移除内存,多个会话不能同时修改被pinned的buffer。

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

转载于:http://blog.itpub.net/29802484/viewspace-2121785/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值