Buffer Cache Experiment 2: Detailed buffer header--dump buffer combined with X$BH view

Source: Internet
Author: User
Tags final hash relative touch

Buffer header structure Diagram and introduction

Figure 1:

Buffer header: Each data block is read into the buffer cache, will first in the buffer cache to construct a buffer Header,buffer header and data block one by one corresponding. The main information contained in the buffer header is:

1 The actual memory address of the data block in the buffer cache. Is the meaning of the dashed arrow in the above figure.

2 The type of the block, including data, segment header, undo header, undo blocks, and so on.

3 The hash chain of the buffer header is implemented by holding a pointer to the previous buffer header in the buffer header and pointing to a pointer to the latter buffer header.

4 The buffer header is located in the LRU, Lruw, CKPTQ, and other linked lists (these linked lists we will be detailed later). It is also achieved by recording the buffer header pointer before and after.

5 The status of the data block corresponding to the current buffer header and the mark.

6 The number of times the buffer header is accessed (touch).

7 is waiting for the buffer header's process list (waiter list) and the list of processes that are using the buffer header (user list).

The buffer specified in DUMP block--contains BH method as follows: --database version: 11.2.0.4

-Add, if it is to dump the entire buffer CACHE, you can refer to: http://blog.csdn.net/haibusuanyun/article/details/17439845

bys@ bys3>select dept.*,dbms_rowid.rowid_object (ROWID) object#,dbms_rowid.rowid_relative_fno rowid (FILE#,DBMS_) Rowid.rowid_block_number (ROWID) block#,dbms_rowid.rowid_row_number (ROWID) row# from dept;

DEPTNO dname LOC object# file# block#

---------- -------------- ------------- ---------- ---------- ---------- ----------

Ten ACCOUNTING NEW YORK 22327 4 251 0

DALLAS 22327 4 251 1

OPERATIONS BOSTON 22327 4 251 2

Chedan BJ 22327 4 251 3

bys@ bys3>select dbms_utility.make_data_block_address (4,251) from dual;

Dbms_utility. Make_data_block_address (4,251)

-------------------------------------------

16777467

Alter session SET Events ' immediate trace name SET_TSN_P1 level 5 ';

Alter session SET Events ' immediate trace name buffer level 16777467 ';

Select value from V$diag_info where name like ' de% ';

SELECT * from X$BH where dbarfil=4 and dbablk=251; Use the SYS user to view the corresponding information from the X$BH against the dump file.

#########################################################

Interpretation of Buffer Header--combined with X$BH

Description: A block method in DUMP buffer is the previous step, which can be queried or DML from multiple sessions, and then dump this block. The contents of the two BH below are not captured from the same dump-generated file. Here we only introduce the meaning of each field in the BH of the dump file, and write the correspondence of the fields in the BH already known to the X$BH,V$BH. About fields in X$bh, you can refer to: The meaning of each field in X$BH

And for like: Under what circumstances Lru-flags:hot_buffer or lru-flags:moved_to_tail, under what circumstances ST:CR or st:xcurrent, temporarily not in this article discussion scope!

As far as possible in the dump of BH in the order of the sentence to read, but because Ru-flags:flags:obj-flags: this does not appear in every dump, so this piece of content together-note my following ru-flags:flags: Obj-flags: Wait in the following posted out of two BH may not appear, is from other dump file posted.

Finally, there are few references in this area, there are inevitable omissions, welcome to add, pointing wrong!!

######

Dump of buffer cache at level for tsn=4 rdba=16777467

1. BH (0x213e6ad0) file#: 4 rdba:0x010000fb (4/251) class:1 ba:0x210b0000

2. Set:3 pool:3 bsz:8192 bsi:0 sflg:1 pwc:0,0

3. dbwrid:0 obj:22327 objn:22327 tsn:4 afn:4 hint:f

4. Hash: [0x2bbfddf4,0x213e7680] LRU: [0X213E76B0,0X22FF07EC]

5. Lru-flags:moved_to_tail

6. CKPTQ: [null] FILEQ: [null] OBJQ: [null] OBJAQ: [NULL]

7. ST:CR md:null fpin: ' Kdswh11:kdst_fetch ' tch:1

8. CR: [scn:0x0.3a9dcc],[xid:0x0.0.0],[uba:0x0.0.0],[cls:0x0.3a9dcc],[sfl:0x0],[lc:0x0.359e7e]

9. flags:only_sequential_access

Buffer Tsn:4 RDBA:0X010000FB (4/251)

scn:0x0000.00359e7e seq:0x01 flg:0x04 tail:0x9e7e0601

frmt:0x02 CHKVAL:0X8CD6 Type:0x06=trans Data

Hex dump of Block:st=0, typ_found=1

A second

BH (0X21FE5DEC) file#: 4 rdba:0x010000fb (4/251) class:1 ba:0x21c92000

Set:3 pool:3 bsz:8192 bsi:0 sflg:1 pwc:0,0

dbwrid:0 obj:22327 objn:22327 Tsn:4 afn:4 hint:f

Hash: [0x213e7680,0x233f2418] LRU: [0x233f76c8,0x233f2448]

CKPTQ: [NULL] FILEQ: [null] OBJQ: [0x233f76e0,0x240796ec] Objaq: [0x233f76e8,0x240796e4]

Use: [NULL] wait: [NULL]

St:xcurrent md:null fpin: ' Kdswh11:kdst_fetch ' Tch:2 txn:0x293d0380

Flags:private

Lrba: [0x0.0.0] LSCN: [0X0.3A9DCD] HSCN: [0X0.3A9DCD] Hsub: [65535]

Buffer Tsn:4 RDBA:0X010000FB (4/251)

scn:0x0000.00359e7e seq:0x01 flg:0x04 tail:0x9e7e0601

frmt:0x02 CHKVAL:0X8CD6 Type:0x06=trans Data

Hex dump of corrupt header 3 = Chkval

Dump of memory from 0x21c92000 to 0x21c92014

#############################################

Read the buffer Header, but also the corresponding fields in the X$BH more detailed interpretation

First sentence:

BH (0x213e6ad0) file#: 4 rdba:0x010000fb (4/251) class:1 ba:0x210b0000

BH (0X213E6AD0), which is the hash value of BH

file#: 4, corresponding to X$BH. file#, this block is in document 4th, through V$dbfile. file# can find out the corresponding data file

RDBA:0X010000FB (4/251), RDBA is the relative file number rfile#+block# block number in rowID. By Dbms_rowid the rfile#+block# of the block, select Dbms_utility.make_data_block_address (4,251) from dual is used to compute the decimal rdba. Here 10000FB is converted to 10 by the To_number function, which is calculated before: 16777467. When 0X010000FB is converted to binary, the relative file Number 10-bit block number 22 bits.

Class:1, corresponding X$bh.class--represents the type of the buffer header corresponding to the block, 1=data block. See this section of buffer header resolution final.

ba:0x210b0000 corresponds to the x$bh.ba, which is the block address in buffer, which is the physical location in memory.

second sentence:

Set:3 pool:3 bsz:8192 bsi:0 sflg:1 pwc:0,0

Set:3: Corresponds to X$BH. STATE,CR (3) = as a consistent read image of the data block, see this section of the buffer header parsing final.

bsz:8192, block size 8192KB. This can be in dba_tablespaces. Block_size queries out the block size of the data file.

third sentence:

dbwrid:0 obj:22327 objn:22327 Tsn:4 afn:4 hint:f

obj:22327, corresponding to X$BH. OBJ, which is where the data on the block is--dba_objects. DATA_OBJECT_ID, there are many channels for this query.

Fourth sentence:

Hash: [0x2bbfddf4,0x213e7680] LRU: [0X213E76B0,0X22FF07EC]

Hash: [0x2bbfddf4,0x213e7680] One by one corresponds to X$bh.nxt_hash x$bh.prv_hash here with the list, pointing to the next and the first BH hash value. If there is only one BH on this hash chain, then the hash value of the first and last BH here is this BH.

LRU: [0x213e76b0,0x22ff07ec] One by one corresponds to the X$bh.nxt_repl x$bh.prv_repl here with the list, pointing to the next and the first BH in the LRU chain on the hash value.

Fifth sentence:

Lru-flags:moved_to_tail corresponds to X$BH. Lru_flag says the block undergoes a full table scan, which is moved to the cold end of the LRU and may be out at any time.

Lru-flags is 0 o'clock and may not display lru-flags in dump buffer: this line.

Lru-flags:on_auxiliary_list

Likely to occur:

Obj-flags:object_ckpt_list corresponds to X$BH. Obj_flag, the correspondence of the file queue corresponds to the X$BH. Rflag

Flags:only_sequential_access corresponds to X$BH. FLAG

Flags:buffer_dirty Block_written_once Redo_since_read-flags that may appear this state after DML

Flags:buffer_dirty Redo_since_read

Sixth sentence:

CKPTQ: [NULL] FILEQ: [null] OBJQ: [0x22ff8054,0x24839390] Objaq: [0x22ff805c,0x24839388]

CKPTQ: [NULL] hash value on checkpoint queue, NULL here

Fileq: [NULL] hash value on file queue

OBJQ: [0x22ff8054,0x24839390] corresponds to X$BH.OQ_NXT x$bh.oq_prv. Object Queue Hash Value

objaq: [0x22ff805c,0x24839388] corresponds to X$BH.AQ_NXT x$bh.aq_prv. Secondary object Queue hash value

Seventh sentence

ST:CR md:null fpin: ' Kdswh11:kdst_fetch ' tch:1

ST:CR: Corresponds to X$bh.state CR, a consistent read (stale) block image. See this section of buffer header resolution final.

Tch:1 corresponds to X$BH. Tch,touch abbreviation for a buffer number of visits-but not absolute, 3 seconds to access the same piece, TCH does not increase. One of the fields related to this is: X$bh.tim--touch time

eighth sentence

CR: [scn:0x0.3a9dcc],[xid:0x0.0.0],[uba:0x0.0.0],[cls:0x0.3a9dcc],[sfl:0x0],[lc:0x0.359e7e]

[SCN:0X0.3A9DCC] SCN when this CR block is generated

nineth sentence:

Buffer Tsn:4 RDBA:0X010000FB (4/251)

The TSN table space number and RDBA of this block

Tenth sentence:

scn:0x0000.00359e7e seq:0x01 flg:0x04 tail:0x9e7e0601

SCN: 0X0000.00359E7E,SCN Direct conversion to use the To_number function to convert to 10 is the SCN detected in the database, which is the SCN when the state of this block changes. See: http://blog.csdn.net/haibusuanyun/article/details/17029517

seq:0x01

flg:0x04 flg:0x01 (new block) 0x2 (block delay cleaning propulsion SCN and seq) 0x04 (set checksum) 0x08 (temporary block) 0x00 Common block

11th sentence:

frmt:0x02 CHKVAL:0X8CD6 Type:0x06=trans Data

TYPE:0X06 (table/index block)

FRMT:0X01 (V7) 0x02 (V8)

##############################

the second block BH differs from:

Lrba: [0xe3.e8e5.0] LSCN: [0X0.3A9DCD] HSCN: [0X0.3A9DCD] Hsub: [65535]

LSCN: [0X0.3A9DCD] HSCN: [0X0.3A9DCD] When the scn--of the modification is recorded with a modified SCN, this hex can be converted to the SCN for comparison

Lrba: [0xe3.e8e5.0] should be the minimum redo byte addres,[0xe3.e8e5.0] corresponding to the log number, block number, first byte. There may also be hrba, recovery RBA.

Use : [null] wait: [NULL] corresponds to the users list in BH; Waiters list

################################################################

Report:

In flag, each represents the following meaning:

Bit bit

0 Buffer_dirty Stale

1 Notify_after_change deferred_ping

2 mod_started direct_access

3 block_has_been_logged Hash_chain_dump

4 Temp_data Ignore_redo

5 Being_written only_sequential_access

6 Waiting_for_write Prefetched_block

7 Multiple_waiters Block_written_once

8 recovery_reading logically_flushed

9 Unlink_from_lock Resilvered_already

Down_grade_lock Redo_since_read

Clone_being_written plugged_from_foreign_db

READING_AS_CR flush_after_writing

Gotten_in_current_mode

Class: Indicates the type of the buffer header corresponding to the BLOCK:

1=data blocks, 9=2nd level BMB,

2=sort blocks, 10=3rd level BMB,

3=save undo block, 11=bitmap block,

4=segment Header, 12=BITMAP index block,

5=save undo Header, 13=unused,

6=free list, 14=undo header,

7=extent Map, 15=undo block

State :

0, free, no valid block image

1, xcur, a current mode blocks, exclusive to this instance is being monopolized by the present instance.

2, Scur, a current mode blocks, shared with the other instances is being instance share

3, CR, a consistent read (stale) block image consistent read

4, read, buffer is reserved for a blocks being read from disk reading chunks from disks

5, MREC, block A, media recovery mode is in the medium recovery model

6, Irec, a block in instance (crash) recovery mode is in the instance recovery mode

0, ' free ', 1, ' Xcur ', 2, ' scur ',

3, ' CR ', 4, ' read ', 5, ' Mrec ',

6, ' Irec ', 7, ' write ', 8, ' pi ', 9, ' memory '

' Mwrite ', one, ' donated ', ' protected ',

' Securefile ', ' siop ', ' recckpt ',

, ' Flashfree ', ' flashcur ', ' Flashna '

Lru_flag

sys@ bys3>select Distinct (lru_flag) from X$BH;

Lru_flag

----------

6

4

8

0

Select Lru_flag,tch,ba,decode (state,0, ' free ', 1, ' Xcur ', 2, ' Scur ', 3, ' Cr ', 4, ' read ', 5, ' Mrec ', 6, ' Irec ', 7, ' write ', 8, '  Pi ', 9, ' memory ', ten, ' Mwrite ', one, ' donated ', #, ' Protected ', ' securefile ', ' siop ', ', ' and ' recckpt ', The ' flashcur ', the ' Flashna ') status from X$bh where file#=4 and dbablk=251;

Select File#,block#,status from V$BH where objd= (select data_object_id from dba_objects where owner= ' bys ' and object_name= ' TEST ') and block#=341892 order by block#;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.