Dion Cho – Oracle Performance Storyteller

We are natural born scientists

Serial Direct Path Read and Block Cleanout(11g)

with 2 comments

Chris Antognini posted an article about the serial direct path read and repeated block cleanout problem here. I’d just like to add my own interpretation on this phenomenon.

In summary,

  1. Oracle needs to cleanout the dirty blocks to determine the status of the block and rolls them back if necessary.
  2. But it does not mean that Oracle modifies the dirty blocks. It just checks the status of the dirty blocks.
  3. So, it does not generate redo and does not physically cleanout the dirty blocks.

Following is the the result of block dump which helps you to understand exactly when Oracle physically modifies the dirty block.

-- before update
 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0007.00a.000036ed  0x00c0032b.1929.08  C---    0  scn 0x07df.2427c615
0x02   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000

-- after update
 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0007.00a.000036ed  0x00c0032b.1929.08  C---    0  scn 0x07df.2427c615
0x02   0x0006.001.0000480a  0x00c010b1.17f3.02  ----    1  fsc 0x0000.00000000 (cleanout is delayed)

-- after direct path read
 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0007.00a.000036ed  0x00c0032b.1929.08  C---    0  scn 0x07df.2427c615
0x02   0x0006.001.0000480a  0x00c010b1.17f3.02  ----    1  fsc 0x0000.00000000 (wasn't cleaned out)

-- after conventional path read
 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0007.00a.000036ed  0x00c0032b.1929.08  C---    0  scn 0x07df.2427c615
0x02   0x0006.001.0000480a  0x00c010b1.17f3.02  C---    0  scn 0x07df.2427ffae (was cleaned out)

Statistics shows another insight.
(block count# is 6010 in my test case)

-- after direct path read
consistent gets from cache                      6,025
consistent gets - examination                   6,011
immediate (CR) block cleanout applicatio        6,010
ns                                                   
cleanout - number of ktugct calls               6,010
cleanouts only - consistent read gets           6,010
commit txn count during cleanout                6,010
redo size                                       4,112

-- after conventional read
redo size                                     438,084
session logical reads                          12,103
consistent gets                                12,076
consistent gets from cache                     12,076
redo entries                                    6,025
consistent gets - examination                   6,016
cleanout - number of ktugct calls               6,016
cleanouts only - consistent read gets           6,010
immediate (CR) block cleanout applicatio        6,010
ns                                                   
commit txn count during cleanout                6,010
consistent gets from cache (fastpath)           5,668

We can tell that Oracle internally cleans out the dirty blocks from the statistics. But the serial direct path read does not load the current version of the block into the buffer cache. So it cannot modify the current block. It just reads the disk-version of the blocks from the data file and refers to the undo to cleanout the dirty blocks.

I think that it is unfair to call this a problem, but under certain situation it might cause problems like ORA-01555 error or repeated reads on the undo.

Footnote1:The traditional term of cleanout meant the modification on the dirty block to me, but I realized that I need more sophiscated terminology.

Footnote2: I believe that the parallel direct path read has the same design and feature with regard to the cleanout mechanism.

About these ads

Written by Dion Cho

July 29, 2009 at 4:15 am

Posted in I/O, Misc.

Tagged with ,

2 Responses

Subscribe to comments with RSS.

  1. Dion
    I do not really agree with your summary. Let explain me why…

    > 1. Oracle needs to cleanout the dirty blocks to determine the status
    > of the block and rolls them back if necessary.

    The process reads a block with an “active” transaction in it. Therefore, it cannot read that block. Either it has to perform a deferred block cleanout or it has to build a CR block. In the situation I showed it does a deferred block cleanout.

    > 2. But it does not mean that Oracle modifies the dirty blocks. It just checks
    > the status of the dirty blocks.

    The process must modify the block. But since the block is modified in the PGA, the modification is not made persistent. In other words, the modified block is not written to disk. If you enable event 10203 at level 3 you can see that happen…

    > 3. So, it does not generate redo and does not physically cleanout the dirty blocks.

    Mhm…. Instead of introducing the term “physically cleanout” I would say: redo is not required because the block is cleaned out only in the PGA.

    Cheers,
    Chris

    Christian Antognini

    August 3, 2009 at 10:33 am

    • Chris.

      Thanks for your valuable comments.

      I totally agree you with you that Oracle cleans out the dirty block in PGA. That’s really what I meant. If my explanation failed at giving that opinion, it’s my fault. The all modification is just done in the PGA level but not shared between processes through SGA. That’s why Oracle cleans out the dirty blocks repeatedly.

      I think that that’s the point here. I couldn’t just find out the official terminology for the cleanout done in PGA. What I reallized is that cleanout and modifying dirty block in the buffer cache are whole different steps. It’s a shame because Oracle has a long history of doing that – it is arealdy doing direct path read on the datafile through parallel query.

      Dion Cho

      August 3, 2009 at 11:10 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 58 other followers

%d bloggers like this: