欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

使用eventsDUMPbuffercache中指定的数据块

程序员文章站 2022-05-17 11:53:09
...

介绍了DUMP buffer cache中全部数据块及指定RDBA的数据块方法。 1.DUMP buffer cache中全部数据块 ALTER SESSION SET EVENTS ‘immediate trace name buffers level n’; 1 buffer header 2 level 1 block header 3 level 2 block contents 4 level 1 hash c

介绍了DUMP buffer cache中全部数据块及指定RDBA的数据块方法。

1.DUMP buffer cache中全部数据块

ALTER SESSION SET EVENTS ‘immediate trace name buffers level n’;
1 buffer header
2 level 1 + block header
3 level 2 + block contents
4 level 1 + hash chain
5 level 2 + hash chain
6 level 3 + hash chain
8 level 4 + users/waiters
9 level 5 + users/waiters
10 level 6 + users/waiters
###############################

2.DUMP buffer cache中指定RDBA的数据块方法

BYS@ bys3>select dbms_rowid.rowid_relative_fno(rowid) fileid,dbms_rowid.rowid_object(rowid) obj#,dbms_rowid.rowid_block_number(rowid) block#,deptno from dept;
FILEID OBJ# BLOCK# DEPTNO
---------- ---------- ---------- ----------
4 22327 251 10
4 22327 251 20
4 22327 251 40
4 22327 251 99
BYS@ bys3>select dbms_utility.make_data_block_address(4,251) from dual; --使用此函数算出rdba--就是rowid中的rfile#+block#
DBMS_UTILITY.MAKE_DATA_BLOCK_ADDRESS(4,251)
-------------------------------------------
16777467

BYS@ bys3>alter session set events 'immediate trace name set_tsn_p1 level 5'; --这里的5是表空间号加1得到的。也就是TS#+1。select ts#,name from v$tablespace;
Session altered.
BYS@ bys3>alter session set events 'immediate trace name buffer level16777467';
Session altered.
BYS@ bys3>select value from v$diag_info where name like 'De%';
VALUE
---------------------------------------------------
/u01/diag/rdbms/bys3/bys3/trace/bys3_ora_21011.trc
###########################

3.查看TRACE文件--就先不解读了

[oracle@bys3 ~]$ cat /u01/diag/rdbms/bys3/bys3/trace/bys3_ora_21011.trc
Trace file /u01/diag/rdbms/bys3/bys3/trace/bys3_ora_21011.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1
System name: Linux
Node name: bys3.bys.com
Release: 2.6.32-200.13.1.el5uek
Version: #1 SMP Wed Jul 27 20:21:26 EDT 2011
Machine: i686
Instance name: bys3
Redo thread mounted by this instance: 1
Oracle process number: 17
Unix process pid: 21011, image: oracle@bys3.bys.com (TNS V1-V3)


*** 2013-12-20 13:22:53.896
*** SESSION ID:(35.1461) 2013-12-20 13:22:53.896
*** CLIENT ID:() 2013-12-20 13:22:53.896
*** SERVICE NAME:(SYS$USERS) 2013-12-20 13:22:53.896
*** MODULE NAME:(SQL*Plus) 2013-12-20 13:22:53.896
*** ACTION NAME:() 2013-12-20 13:22:53.896

Dump of buffer cache at level 10 for tsn=4 rdba=16777467
BH (0x20ff065c) file#: 4 rdba: 0x010000fb (4/251) class: 1 ba: 0x20e1a000
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: [0x21be851c,0x2bbfddf4] lru: [0x21fe8100,0x21ff6c78]
lru-flags: hot_buffer
ckptq: [NULL] fileq: [NULL] objq: [0x21fe8118,0x246ea304] objaq: [0x21fe8120,0x246ea2fc]
st: XCURRENT md: NULL fpin: 'kdswh01: kdstgr' tch: 0
flags: only_sequential_access
LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] 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 block: st=0, typ_found=1
Dump of memory from 0x20E1A000 to 0x20E1C000
20E1A000 0000A206 010000FB 00359E7E 04010000 [........~.5.....]
20E1A010 00008CD6 00000001 00005737 00359E7E [........7W..~.5.]
20E1A020 00000000 00320003 010000F8 00050008 [......2.........]
20E1A030 0000097B 00000000 00000000 0000A000 [{...............]
20E1A040 00359171 00000000 00000000 00000000 [q.5.............]
20E1A050 00000000 00000000 00000000 00000000 [................]
Repeat 1 times
20E1A070 00000000 00000000 00000000 00040100 [................]
20E1A080 001AFFFF 1F0E1F28 00001F0E 1F280004 [....(.........(.]
20E1A090 1F581F42 00001F70 00000000 00000000 [B.X.p...........]
20E1A0A0 00000000 00000000 00000000 00000000 [................]
Repeat 495 times
20E1BFA0 00000000 0203002C 410A0BC1 554F4343 [....,......ACCOU]
20E1BFB0 4E49544E 454E0847 4F592057 002C4B52 [NTING.NEW YORK,.]
20E1BFC0 15C10203 53455208 43524145 41440648 [.....RESEARCH.DA]
20E1BFD0 53414C4C 0203002C 4F0A29C1 41524550 [LLAS,....).OPERA]
20E1BFE0 4E4F4954 4F420653 4E4F5453 0203002C [TIONS.BOSTON,...]
20E1BFF0 630664C1 61646568 6A62026E 9E7E0601 [.d.chedan.bj..~.]
Block header dump: 0x010000fb
Object id on Block? Y
seg/obj: 0x5737 csc: 0x00.359e7e itc: 3 flg: E typ: 1 - DATA
brn: 0 bdba: 0x10000f8 ver: 0x01 opc: 0
inc: 0 exflg: 0

Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0008.005.0000097b 0x00000000.0000.00 C-U- 0 scn 0x0000.00359171
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
0x03 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
bdba: 0x010000fb
data_block_dump,data header at 0x20e1a07c
===============
tsiz: 0x1f80
hsiz: 0x1a
pbl: 0x20e1a07c
76543210
flag=--------
ntab=1
nrow=4
frre=-1
fsbo=0x1a
fseo=0x1f28
avsp=0x1f0e
tosp=0x1f0e
0xe:pti[0] nrow=4 offs=0
0x12:pri[0] offs=0x1f28
0x14:pri[1] offs=0x1f42
0x16:pri[2] offs=0x1f58
0x18:pri[3] offs=0x1f70
block_row_dump:
tab 0, row 0, @0x1f28
tl: 26 fb: --H-FL-- lb: 0x0 cc: 3
col 0: [ 2] c1 0b
col 1: [10] 41 43 43 4f 55 4e 54 49 4e 47
col 2: [ 8] 4e 45 57 20 59 4f 52 4b
tab 0, row 1, @0x1f42
tl: 22 fb: --H-FL-- lb: 0x0 cc: 3
col 0: [ 2] c1 15
col 1: [ 8] 52 45 53 45 41 52 43 48
col 2: [ 6] 44 41 4c 4c 41 53
tab 0, row 2, @0x1f58
tl: 24 fb: --H-FL-- lb: 0x0 cc: 3
col 0: [ 2] c1 29
col 1: [10] 4f 50 45 52 41 54 49 4f 4e 53
col 2: [ 6] 42 4f 53 54 4f 4e
tab 0, row 3, @0x1f70
tl: 16 fb: --H-FL-- lb: 0x0 cc: 3
col 0: [ 2] c1 64
col 1: [ 6] 63 68 65 64 61 6e
col 2: [ 2] 62 6a
end_of_block_dump