關於dirty buffer

來源:互聯網
上載者:User

其實大家對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的深層含義.


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.