Monday, 7 March 2016

SGA Buffer Cache States

Buffer Cache blocks can be in the following states


  • Pinned: Prevent writing to the same block from multiple sessions

  • Clean: Unpinned, candidate for aging

  • Free or Unused: Empty because instance just started

  • Dirty: Buffer not pinned, content changed, DBWn will write to disc

A more details view of the buffer cache can be seen using the v$bh view.
SELECT b.block#,
       b.class#,
       b.status,
       object_name,
       object_type,
       dirty Dirty
  FROM v$bh b,
       dba_objects o
 WHERE b.objd = o.data_object_id
   AND o.owner = 'RAY';

BLOCK# CLASS# STATUS OBJECT_NAME OBJECT_TYPE DIRTY
51425      4 xcur   STF         TABLE       N
51427      1 xcur   STF         TABLE       N
51426      1 xcur   STF         TABLE       N
49328      1 xcur   NOTES       TABLE       N
49325      4 xcur   NOTES       TABLE       N
49327      1 xcur   NOTES       TABLE       N
49326      1 xcur   NOTES       TABLE       N
XCUR state means the instance has exclusive access to the  buffer block and can modify it. CR state means the instance has older version of the block and can perform a consistent read of the block SCUR state means the instance has shared access to the block and can read only PI state means the instance has made changes to the block but holds copies of the block prior to changes.

No comments:

Post a Comment