Oracle的一个数据块里的SCN有三种,分别是块头的SCN, CSC (cleanout SCN)和ITL中记录的commit SCN。 如果我们想查看某个或者某些block 里的内容,可以把这些block dump出来查看。
关于这个dump 方法,在之前的blog里有说明:
Oracle rdba和 dba 说明
OraceITL(Interested Transaction List) 说明
SQL> SELECT
2dbms_rowid.rowid_relative_fno(rowid) REL_FNO,
3dbms_rowid.rowid_block_number(rowid) BLOCKNO,
4dbms_rowid.rowid_row_number(rowid) ROWNO,
5 empno, ename
6 FROM emp WHERE empno = 7369;
REL_FNO BLOCKNO ROWNO EMPNOENAME
---------- -------------------- ---------- ----------
4 20 0 7369 SMITH
SQL> alter system dump datafile 4 block 20;
SQL>ALTER SYSTEM dump datafile block min block max ;
SYS@anqing2(rac2)>
Statement processed.
SYS@anqing2(rac2)>
System altered.
SYS@anqing2(rac2)>
/u01/app/oracle/admin/anqing/udump/anqing2_ora_32276.trc
[oracle@rac2 ~]$
*** 2011-08-01 17:51:31.366
Start dump data blocks tsn: 0file#: 1 minblk 292689 maxblk 292689
buffer tsn: 0 rdba: 0x00447751(1/292689)
scn: 0x0000.005bdee1 seq: 0x01flg: 0x06 tail: 0xdee10601
frmt: 0x02 chkval: 0xaf6f type:0x06=trans data
Hex dump of block: st=0,typ_found=1
Dump of memory from 0x0DC34400to 0x0DC36400
DC34400 0000A206 00447751005BDEE1 06010000 [....QwD...[.....]
......
DC363F0 C3040203 04261C0B65766164 DEE10601 [......&.dave....]
Block header dump: 0x00447751
Object id on Block? Y
seg/obj: 0xd5ec csc: 0x00.5bcbe0 itc: 3 flg: - typ: 1 - DATA
fsl: 0 fnx: 0x0 ver: 0x01
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x000e.007.00000236 0x00000000.0000.00 C-U- 0 scn 0x0000.005b1f7f
0x02 0x000c.005.000003b4 0x01401727.0144.13 C--- 0 scn 0x0000.005bbf0b
0x03 0x0011.007.00000406 0x0140015b.00c7.57 --U- 483 fsc 0x0000.005bdee1
data_block_dump,data header at0xdc34474
===============
tsiz: 0x1f88
SYS@anqing2(rac2)>
TO_NUMBER('1F88','XXXX')
------------------------
8072
hsiz: 0x3d8
pbl: 0x0dc34474
-- Pointer tobuffer holding the block
bdba: 0x00447751
76543210
flag=--------
ntab=1
nrow=483
frre=-1
fsbo=0x3d8
fseo=0x706
avsp=0x32e
tosp=0x32e
0xe:pti[0] nrow=483 offs=0
0x12:pri[0] offs=0x1f7b
0x14:pri[1] offs=0x1f6e
......
0x3d4:pri[481] offs=0x713
0x3d6:pri[482] offs=0x706
block_row_dump:
tab 0, row 0, @0x1f7b
tl: 13 fb: --H-FL-- lb:0x3 cc: 2
col 0: [ 4] c3 0b 1c 26
col 1: [ 4] 64 61 76 65
tab 0, row 1, @0x1f6e
tl: 13 fb: --H-FL-- lb:0x3 cc: 2
col 0: [ 4] c3 0b 1c 27
col 1: [ 4] 64 61 76 65
tab 0, row 2, @0x1f61
tl: 13 fb: --H-FL-- lb:0x3 cc: 2
col 0: [ 4] c3 0b 1c 28
col 1: [ 4] 64 61 76 65
......
tab 0, row 481, @0x713
tl: 13 fb: --H-FL-- lb:0x3 cc: 2
col 0: [ 4] c3 0b 21 13
col 1: [ 4] 64 61 76 65
tab 0, row 482, @0x706
tl: 13 fb: --H-FL-- lb:0x3 cc: 2
col 0: [ 4] c3 0b 21 14
col 1: [ 4] 64 61 76 65
SYS@anqing2(rac2)> setserveroutput on
SYS@anqing2(rac2)> declare nnumber;
2 begin
3
4 dbms_output.put_line(n);
5 end;
6 /
PL/SQL procedure successfullycompleted.
SYS@anqing2(rac2)> declarestr varchar2(100);
2 begin
3
4 dbms_output.put_line(str);
5 end;
6 /
PL/SQL procedure successfullycompleted.
end_of_block_dump
End dump data blocks tsn: 0file#: 1 minblk 292689 maxblk 292689
[oracle@rac2 ~]$