Subscribe to Posts by Email

Subscriber Count

    701

Disclaimer

All information is offered in good faith and in the hope that it may be of use for educational purpose and for Database community purpose, but is not guaranteed to be correct, up to date or suitable for any particular purpose. db.geeksinsight.com accepts no liability in respect of this information or its use. This site is independent of and does not represent Oracle Corporation in any way. Oracle does not officially sponsor, approve, or endorse this site or its content and if notify any such I am happy to remove. Product and company names mentioned in this website may be the trademarks of their respective owners and published here for informational purpose only. This is my personal blog. The views expressed on these pages are mine and learnt from other blogs and bloggers and to enhance and support the DBA community and this web blog does not represent the thoughts, intentions, plans or strategies of my current employer nor the Oracle and its affiliates or any other companies. And this website does not offer or take profit for providing these content and this is purely non-profit and for educational purpose only. If you see any issues with Content and copy write issues, I am happy to remove if you notify me. Contact Geek DBA Team, via geeksinsights@gmail.com

Pages

Buffer states: How many consistent read (cr) clones in buffer cache, verified.

We all know to maintain the consistency of the buffers and its integrity oracle has to clone the current copy of the buffer to consistent read and change the latest one. There are different buffer states in x$bh column out of all our interest to this post is only to cr and xcur.

First lets create a table with one block and the issue updates

Our check would be how many cr clones it can create. Is there any maximum limit.

image

Insert some rows

image

Check the block filenum and the block address

image

Run this query what is our block status in the buffer cache.

select b.dbarfil, b.dbablk, b.class,
decode(state,0,'free',1,'xcur',2,'scur',3,'cr', 4,'read',5,'mrec',6,'irec',
7,'write',8,'pi', 9,'memory',10,'mwrite',11,'donated') as state,
cr_scn_bas, cr_scn_wrp, cr_uba_fil, cr_uba_blk, cr_uba_seq,
(select object_name from dba_objects where object_id = b.obj) as object_name
from sys.x$bh b where dbarfil = &file_no and
dbablk = &block_no;

 

image

We have got a block with xcur state, now give few updates.

 

image

See the buffer states using above query.

image

You have got a CR block now. Few more update

image

Check again, you have got 2 CR blocks

image

Few more updates again,

 

image

Check again,

image

Now hold, Despite of giving 8-10 updates I still have 6 buffers (5 CR + 1 XCUR) buffers , this is due to the hidden parameter that controls the cr clones _db_block_max_cr_dba

Hidden parameter query:-

SELECT
  a.ksppinm  "Parameter",
  decode(p.isses_modifiable,'FALSE',NULL,NULL,NULL,b.ksppstvl) "Session",
  c.ksppstvl "Instance",
  decode(p.isses_modifiable,'FALSE','F','TRUE','T') "S",
  decode(p.issys_modifiable,'FALSE','F','TRUE','T','IMMEDIATE','I','DEFERRED','D') "I",
  decode(p.isdefault,'FALSE','F','TRUE','T') "D",
  a.ksppdesc "Description"
FROM x$ksppi a, x$ksppcv b, x$ksppsv c, v$parameter p
WHERE a.indx = b.indx AND a.indx = c.indx
  AND p.name(+) = a.ksppinm
  AND UPPER(a.ksppinm) LIKE UPPER('%&1%')
ORDER BY a.ksppinm;

image

Now change the parameter to 8 and shut down the db and start up again.

image

Back to work, Update the rows (more than 8)

image

Now, you can see 8 rows only as "_db_block_max_cr_dba" is 8

image

Now issue query on test table and see

image

Observe the change in the SCN for xcur, and the top most row came from the undo due to the fact that one of the session need a consistent read record and has been read from undo.

image

 

Again hold the parameter "_db_block_max_cr_dba"= is not a hard limit, its just a soft limit, I tried with in the same session of updating same row, if you try opening fewer more session and updating different rows the limit of the 8 can go exceed without changing the parameter. No control over in real.

Hope this

2 comments to Buffer states: How many consistent read (cr) clones in buffer cache, verified.