首页 > 开发 > 综合 > 正文

关于dirty buffer

2024-07-21 02:07:56
字体:
来源:转载
供稿:网友

其实大家对v$bh这个视图可能一直重视不够.

我们来看一下这个视图主要字段说明:


status

varchar2(1)

status of the buffer:
free - not currently in use xcur - exclusive scur - shared current cr - consistent read read - being read from disk mrec - in media recovery mode irec - in instance recovery mode ?


dirty

varchar2(1)

y - block modified

temp

varchar2(1)

y - temporary block

ping

varchar2(1)

y - block pinged

stale

varchar2(1)

y - block is stale

direct

varchar2(1)

y - direct block


?

我们注意到v$dirty代表的就是block modified

?

如果我们进一步向下追溯:

sql> select view_definition from v$fixed_view_definition where view_name = 'gv$bh';

view_definition
--------------------------------------------------------------------------------
select bh.inst_id, file#, dbablk, class, decode(state,0,'free',1,'xcur',2,'scur'
,3,'cr', 4,'read',5,'mrec',6,'irec',7,'write',8,'pi'), x_to_null, forced_reads,
forced_writes, bh.le_addr, name,le_class, decode(bitand(flag,1), 0, 'n', 'y'), d
ecode(bitand(flag,16), 0, 'n', 'y'), decode(bitand(flag,1536), 0, 'n', 'y'), dec
ode(bitand(flag,16384), 0, 'n', 'y'), decode(bitand(flag,65536), 0, 'n', 'y'), '
n', obj, ts# from x$bh bh, x$le le where bh.le_addr = le.le_addr (+)


我们可以看到v$bh的底层表示x$bh

其中v$bh中的dirty/temp/ping/stale/direct五个字段来源于x$bh中的flag字段

格式化一下输出:

select bh.inst_id, file#, dbablk, class,
?????? decode (state,
?????????????? 0, 'free',
?????????????? 1, 'xcur',
?????????????? 2, 'scur',
?????????????? 3, 'cr',
?????????????? 4, 'read',
?????????????? 5, 'mrec',
?????????????? 6, 'irec',
?????????????? 7, 'write',
?????????????? 8, 'pi'
????????????? ),
?????? x_to_null, forced_reads, forced_writes, bh.le_addr, name, le_class,
?????? decode (bitand (flag, 1), 0, 'n', 'y'),
?????? decode (bitand (flag, 16), 0, 'n', 'y'),
?????? decode (bitand (flag, 1536), 0, 'n', 'y'),
?????? decode (bitand (flag, 16384), 0, 'n', 'y'),
?????? decode (bitand (flag, 65536), 0, 'n', 'y'), 'n', obj, ts#
? from x$bh bh, x$le le
?where bh.le_addr = le.le_addr(+)


由此我们得以窥视x$bh.flag的深层含义.
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表