ITPub博客

首页 > 数据库 > Oracle > database buffer cache之我见

database buffer cache之我见

原创 Oracle 作者:zhangsharp20 时间:2016-07-10 11:56:22 0 删除 编辑
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博客 ” ,链接:https://blog.itpub.net/29802484/viewspace-2121785/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: MYSQL密码管理
请登录后发表评论 登录
全部评论

注册时间:2014-08-12

  • 博文量
    382
  • 访问量
    801410