Oracle数据库块之旅

Posted dingdingfish

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle数据库块之旅相关的知识,希望对你有一定的参考价值。

本文是观看视频A tour of the Oracle Database Block的笔记。

Hex Dump of block?

termiology 101:
Segment, Extent, Blocks

经典的图示:

21c时的图示:

Extent是Chunk of data file。因此有以下三个属性:

  • file
  • start position
  • length

按照文档的说法,Extent Size最小为64KB,随着对象变大,Extent Size相应变为1M,8M,64M。

For system-managed extents, Oracle determines the optimal size of additional extents, with a minimum extent size of 64 KB. If the tablespaces are created with ‘segment space management auto’, and if the database block size is 16K or higher, then Oracle manages segment size by creating extents with a minimum size of 1M. This is the default for permanent tablespaces.

对象最开始部分的数据库块:

SQL> desc dba_segments;

              Name    Null?             Type
__________________ ________ ________________
...
HEADER_FILE                 NUMBER
HEADER_BLOCK                NUMBER
...

参照DBA_SEGMENTS的说明:

  • HEADER_FILE:Absolute file number of the data file containing the segment header
  • HEADER_BLOCK:ID of the block containing the segment header

接下来就是Extent中的数据库块了:

SQL> desc dba_extents
              Name    Null?             Type
__________________ ________ ________________
OWNER                       VARCHAR2(128)
SEGMENT_NAME                VARCHAR2(128)
PARTITION_NAME              VARCHAR2(128)
SEGMENT_TYPE                VARCHAR2(18)
TABLESPACE_NAME             VARCHAR2(30)
EXTENT_ID                   NUMBER
FILE_ID                     NUMBER <- 文件
BLOCK_ID                    NUMBER <- 数据库块 ID
BYTES                       NUMBER
BLOCKS                      NUMBER <- 数据库块数量
RELATIVE_FNO                NUMBER

参照DBA_EXTENTS的说明:

  • FILE_ID:Absolute file number of the data file containing the extent
  • BLOCK_ID:Starting block number of the extent
  • BLOCKS:Size of the extent in Oracle blocks

创建测试表:

create table T(x number, y number, z varchar2(10));
insert into T values(10, 10, 'Connor');
commit;

查看Segment开始部分的block,并获取数据文件名:

SQL> select HEADER_FILE, HEADER_BLOCK from dba_segments where segment_name = 'T';

   HEADER_FILE    HEADER_BLOCK
______________ _______________
            12          253362

SQL> select name from v$datafile where file# = 12;

                                               NAME
___________________________________________________
/opt/oracle/oradata/ORCLCDB/ORCLPDB1/users01.dbf

SQL> show parameter block_size;
NAME          TYPE    VALUE
------------- ------- -----
db_block_size integer 8192

查看头部数据库块中的内容,其中skip的值对应于HEADER_BLOCK,bs对于block size,hexdump等同于od -h。输出中每行为16字节,*行表示省略:

$ dd if=users01.dbf bs=8192 skip=253362 count=1|hexdump
0000000 a223 0000 ddb2 0303 f493 0157 0000 0401
0000010 83f8 0000 0000 0000 0000 0000 0000 0000
0000020 0000 0000 0001 0000 0008 0000 0a9c 0000
0000030 0000 0000 0008 0000 0008 0000 ddb8 0303
0000040 0000 0000 0000 0000 0000 0000 0005 0000
0000050 0000 0000 0000 0000 0000 0000 0000 0000
0000060 0008 0000 0008 0000 ddb8 0303 0000 0000
0000070 0000 0000 0000 0000 0005 0000 ddb0 0303
0000080 ddb0 0303 0000 0000 0000 0000 0000 0000
0000090 0000 0000 0000 0000 0000 0000 0000 0000
*
00000d0 0001 0000 2000 0000 0000 0000 1434 0000
00000e0 0000 0000 ddb1 0303 0001 0000 ddb0 0303
00000f0 ddb1 0303 0000 0000 0000 0000 0000 0000
0000100 0000 0000 0000 0000 0001 0000 0000 0000
0000110 2925 0001 0000 1000 ddb0 0303 0008 0000
0000120 0000 0000 0000 0000 0000 0000 0000 0000
*
0000ab0 ddb0 0303 ddb3 0303 0000 0000 0000 0000
0000ac0 0000 0000 0000 0000 0000 0000 0000 0000
*
0001440 0000 0000 0000 0000 ddb1 0303 0000 0000
0001450 0000 0000 0000 0000 0000 0000 0000 0000
*
0001ff0 0000 0000 0000 0000 0000 0000 2301 f493
0002000

利用Oracle命令导出block内容,输出在Trace file中:

SQL> alter system dump datafile 12 block 253362;

System DUMP altered.

SQL> SELECT VALUE FROM V$DIAG_INFO WHERE NAME = 'Default Trace File';

                                                               VALUE
____________________________________________________________________
/opt/oracle/diag/rdbms/orclcdb/ORCLCDB/trace/ORCLCDB_ora_5388.trc

alter system dump属于内部命令,在Oracle标准文档中找不到帮助。

查看Trace File,完整的输出如下:

$ cat /opt/oracle/diag/rdbms/orclcdb/ORCLCDB/trace/ORCLCDB_ora_5388.trc
Start dump data blocks tsn: 5 file#:12 minblk 253362 maxblk 253362
Block dump from cache:
Dump of buffer cache at level 3 for pdb=3 tsn=5 rdba=50585010
BH (0xd2faf098) file#: 12 rdba: 0x0303ddb2 (12/253362) class: 4 ba: 0xd28a2000
  set: 5 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 0,0
  dbwrid: 0 obj: 76069 objn: 76069 tsn: [3/5] afn: 12 hint: f
  hash: [0xdbf73d78,0xb3fcca60] lru: [0xd2faf2e8,0xd2faf018]
  ckptq: [NULL] fileq: [NULL]
  objq: [0xd2faf040,0xd2fae938] objaq: [0x941198e0,0xd2faf050]
  st: XCURRENT md: NULL fpin: 'ktswh03: ktscts' fscn: 0x157f47c tch: 1
  flags: block_written_once
  LRBA: [0x0.0.0] LSCN: [0x0] HSCN: [0x157f493] HSUB: [1]
  Printing buffer operation history (latest change first):
  cnt: 12
  01. sid:06 L192:kcbbic2:bic:FBD     02. sid:06 L191:kcbbic2:bic:FBW
  03. sid:06 L602:bic1_int:bis:FWC    04. sid:06 L822:bic1_int:ent:rtn
  05. sid:06 L832:oswmqbg1:clr:WRT    06. sid:06 L930:kubc:sw:mq
  07. sid:06 L913:bxsv:sw:objq        08. sid:06 L608:bxsv:bis:FBW
  09. sid:06 L607:bxsv:bis:FFW        10. sid:15 L464:chg1_mn:bic:FMS
  11. sid:15 L778:chg1_mn:bis:FMS     12. sid:15 L353:gcur:set:MEXCL
  13. sid:15 L464:chg1_mn:bic:FMS     14. sid:15 L778:chg1_mn:bis:FMS
  15. sid:15 L353:gcur:set:MEXCL      16. sid:15 L464:chg1_mn:bic:FMS
  buffer tsn: 5 rdba: 0x0303ddb2 (12/253362)
  scn: 0x157f493 seq: 0x01 flg: 0x04 tail: 0xf4932301
  frmt: 0x02 chkval: 0x83f8 type: 0x23=PAGETABLE SEGMENT HEADER
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x00000000D28A2000 to 0x00000000D28A4000
0D28A2000 0000A223 0303DDB2 0157F493 04010000  [#.........W.....]
0D28A2010 000083F8 00000000 00000000 00000000  [................]
0D28A2020 00000000 00000001 00000008 00000A9C  [................]
0D28A2030 00000000 00000008 00000008 0303DDB8  [................]
0D28A2040 00000000 00000000 00000000 00000005  [................]
0D28A2050 00000000 00000000 00000000 00000000  [................]
0D28A2060 00000008 00000008 0303DDB8 00000000  [................]
0D28A2070 00000000 00000000 00000005 0303DDB0  [................]
0D28A2080 0303DDB0 00000000 00000000 00000000  [................]
0D28A2090 00000000 00000000 00000000 00000000  [................]
        Repeat 3 times
0D28A20D0 00000001 00002000 00000000 00001434  [..... ......4...]
0D28A20E0 00000000 0303DDB1 00000001 0303DDB0  [................]
0D28A20F0 0303DDB1 00000000 00000000 00000000  [................]
0D28A2100 00000000 00000000 00000001 00000000  [................]
0D28A2110 00012925 10000000 0303DDB0 00000008  [%)..............]
0D28A2120 00000000 00000000 00000000 00000000  [................]
        Repeat 152 times
0D28A2AB0 0303DDB0 0303DDB3 00000000 00000000  [................]
0D28A2AC0 00000000 00000000 00000000 00000000  [................]
        Repeat 151 times
0D28A3440 00000000 00000000 0303DDB1 00000000  [................]
0D28A3450 00000000 00000000 00000000 00000000  [................]
        Repeat 185 times
0D28A3FF0 00000000 00000000 00000000 F4932301  [.............#..]
  Extent Control Header
  -----------------------------------------------------------------
  Extent Header:: spare1: 0      spare2: 0      #extents: 1      #blocks: 8
                  last map  0x00000000  #maps: 0      offset: 2716
      Highwater::  0x0303ddb8  ext#: 0      blk#: 8      ext size: 8
  #blocks in seg. hdr's freelists: 0
  #blocks below: 5
  mapblk  0x00000000  offset: 0
                   Unlocked
  --------------------------------------------------------
  Low HighWater Mark :
      Highwater::  0x0303ddb8  ext#: 0      blk#: 8      ext size: 8
  #blocks in seg. hdr's freelists: 0
  #blocks below: 5
  mapblk  0x00000000  offset: 0
  Level 1 BMB for High HWM block: 0x0303ddb0
  Level 1 BMB for Low HWM block: 0x0303ddb0
  --------------------------------------------------------
  Segment Type: 1 nl2: 1      blksz: 8192   fbsz: 0
  L2 Array start offset:  0x00001434
  First Level 3 BMB:  0x00000000
  L2 Hint for inserts:  0x0303ddb1
  Last Level 1 BMB:  0x0303ddb0
  Last Level II BMB:  0x0303ddb1
  Last Level III BMB:  0x00000000
     Map Header:: next  0x00000000  #extents: 1    obj#: 76069  flag: 0x10000000
  Inc # 0
  Extent Map
  -----------------------------------------------------------------
   0x0303ddb0  length: 8

  Auxillary Map
  --------------------------------------------------------
   Extent 0     :  L1 dba:  0x0303ddb0 Data dba:  0x0303ddb3
  --------------------------------------------------------

   Second Level Bitmap block DBAs
   --------------------------------------------------------
   DBA 1:   0x0303ddb1

Block dump from disk:
buffer tsn: 5 rdba: 0x0303ddb2 (12/253362)
scn: 0x157f493 seq: 0x01 flg: 0x04 tail: 0xf4932301
frmt: 0x02 chkval: 0x83f8 type: 0x23=PAGETABLE SEGMENT HEADER
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x00007F130395F000 to 0x00007F1303961000
7F130395F000 0000A223 0303DDB2 0157F493 04010000  [#.........W.....]
7F130395F010 000083F8 00000000 00000000 00000000  [................]
7F130395F020 00000000 00000001 00000008 00000A9C  [................]
7F130395F030 00000000 00000008 00000008 0303DDB8  [................]
7F130395F040 00000000 00000000 00000000 00000005  [................]
7F130395F050 00000000 00000000 00000000 00000000  [................]
7F130395F060 00000008 00000008 0303DDB8 00000000  [................]
7F130395F070 00000000 00000000 00000005 0303DDB0  [................]
7F130395F080 0303DDB0 00000000 00000000 00000000  [................]
7F130395F090 00000000 00000000 00000000 00000000  [................]
        Repeat 3 times
7F130395F0D0 00000001 00002000 00000000 00001434  [..... ......4...]
7F130395F0E0 00000000 0303DDB1 00000001 0303DDB0  [................]
7F130395F0F0 0303DDB1 00000000 00000000 00000000  [................]
7F130395F100 00000000 00000000 00000001 00000000  [................]
7F130395F110 00012925 10000000 0303DDB0 00000008  [%)..............]
7F130395F120 00000000 00000000 00000000 00000000  [................]
        Repeat 152 times
7F130395FAB0 0303DDB0 0303DDB3 00000000 00000000  [................]
7F130395FAC0 00000000 00000000 00000000 00000000  [................]
        Repeat 151 times
7F1303960440 00000000 00000000 0303DDB1 00000000  [................]
7F1303960450 00000000 00000000 00000000 00000000  [................]
        Repeat 185 times
7F1303960FF0 00000000 00000000 00000000 F4932301  [.............#..]
  Extent Control Header
  -----------------------------------------------------------------
  Extent Header:: spare1: 0      spare2: 0      #extents: 1      #blocks: 8
                  last map  0x00000000  #maps: 0      offset: 2716
      Highwater::  0x0303ddb8  ext#: 0      blk#: 8      ext size: 8
  #blocks in seg. hdr's freelists: 0
  #blocks below: 5
  mapblk  0x00000000  offset: 0
                   Unlocked
  --------------------------------------------------------
  Low HighWater Mark :
      Highwater::  0x0303ddb8  ext#: 0      blk#: 8      ext size: 8
  #blocks in seg. hdr's freelists: 0
  #blocks below: 5
  mapblk  0x00000000  offset: 0
  Level 1 BMB for High HWM block: 0x0303ddb0
  Level 1 BMB for Low HWM block: 0x0303ddb0
  --------------------------------------------------------
  Segment Type: 1 nl2: 1      blksz: 8192   fbsz: 0
  L2 Array start offset:  0x00001434
  First Level 3 BMB:  0x00000000
  L2 Hint for inserts:  0x0303ddb1
  Last Level 1 BMB:  0x0303ddb0
  Last Level II BMB:  0x0303ddb1
  Last Level III BMB:  0x00000000
     Map Header:: next  0x00000000  #extents: 1    obj#: 76069  flag: 0x10000000
  Inc # 0
  Extent Map
  -----------------------------------------------------------------
   0x0303ddb0  length: 8

  Auxillary Map
  --------------------------------------------------------
   Extent 0     :  L1 dba:  0x0303ddb0 Data dba:  0x0303ddb3
  --------------------------------------------------------

   Second Level Bitmap block DBAs
   --------------------------------------------------------
   DBA 1:   0x0303ddb1

End dump data blocks tsn: 5 file#: 12 minblk 253362 maxblk 253362

输出中,以下显示了Block类型:

frmt: 0x02 chkval: 0x83f8 type: 0x23=PAGETABLE SEGMENT HEADER


KCBH表示Kernel Cache Block Header,TYPE_SIZE的单位为字节:

SQL> select * from v$type_size where type = 'KCBH';

   COMPONENT    TYPE            DESCRIPTION    TYPE_SIZE    CON_ID
____________ _______ ______________________ ____________ _________
KCB          KCBH    BLOCK COMMON HEADER              20         0

从Extent的角度看,此表有1个Extent,Extent大小为8个数据块(64KB)。将Extent整个导出:

SQL> select file_id, block_id, blocks, bytes, relative_fno from dba_extents where segment_name = 'T';
   FILE_ID    BLOCK_ID    BLOCKS    BYTES    RELATIVE_FNO
__________ ___________ _________ ________ _______________
        12      253360         8    65536              12

SQL> alter system dump datafile 12 block min 253360 block max 253367;

从Trace File查看8个数据块的类型:

$ grep ^frmt /opt/oracle/diag/rdbms/orclcdb/ORCLCDB/trace/ORCLCDB_ora_7597.trc
frmt: 0x02 chkval: 0x3877 type: 0x20=FIRST LEVEL BITMAP BLOCK
frmt: 0x02 chkval: 0x71e7 type: 0x21=SECOND LEVEL BITMAP BLOCK
frmt: 0x02 chkval: 0x83f8 type: 0x23=PAGETABLE SEGMENT HEADER
frmt: 0x02 chkval: 0x1dea type: 0x06=trans data
frmt: 0x02 chkval: 0xeda7 type: 0x06=trans data
frmt: 0x02 chkval: 0x1dec type: 0x06=trans data
frmt: 0x02 chkval: 0x1def type: 0x06=trans data
frmt: 0x02 chkval: 0x1dee type: 0x06=trans data

实际的数据是从第4个数据块开始的,数据块的类型为trans data。此类型的segment对象包括表,索引和cluster。我们来解析第4个数据块的详情:

Block dump from disk:
buffer tsn: 5 rdba: 0x0303ddb3 (12/253363)
scn: 0x157f493 seq: 0x02 flg: 0x04 tail: 0xf4930602
frmt: 0x02 chkval: 0x1dea type: 0x06=trans data
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x00007F1DDC55D000 to 0x00007F1DDC55F000
7F1DDC55D000 0000A206 0303DDB3 0157F493 04020000  [..........W.....]

第一行的0000A206,其中06即表示block type为transactional data。A表示block size为8K(6=2k,8=4k,A=8k,C=16k)。A后面的2表示数据库版本8,9,10,11,1则表示8之前。不同的版本,block的格式有所不同。

接下来看rdba,其表示relative data block address,由file和block两部分组成。其值为3ddb3(253363),也就是第4个block。括号中的12表示file#:

SQL> select to_number('0303ddb3', 'xxxxxxxx') rdba from dual;

       RDBA
___________
   50585011

SQL> select dbms_utility.data_block_address_file(50585011) F, dbms_utility.data_block_address_block(50585011) B from dual;

    F         B
_____ _________
   12    253363

SQL> select to_char(dbms_utility.make_data_block_address(12, 253363), 'xxxxxxxx') rdba from dual;

        RDBA
____________
  303ddb3

to_number的帮助见这里
to_char的帮助见这里
DBMS_UTILITY的帮助见这里

接下来看SCN(System Change Number),即数据库的时间戳。也就是rdba后面的部分0157F493

-- 当时的SCN
SQL> select to_number('0157F493', 'xxxxxxxx') from dual;

   TO_NUMBER('0157F493','XXXXXXXX')
___________________________________
                           22541459

-- 当前的SCN
SQL> select CURRENT_SCN from v$database;

   CURRENT_SCN
______________
      22549846

接下来的0402,02表示block sequence number,04表示flag。

block sequence number表示在同一SCN下更改block的序号,例如在本例中,update的block sequence number为0x01,而commit的block sequence number则为0x02。

alter system dump logfile

通过将redo log导出可以看到详细的更改:

SQL> select object_id from dba_objects where object_name = 'T';

   OBJECT_ID
____________
       76069

SQL> ALTER SYSTEM DUMP LOGFILE '/opt/oracle/oradata/ORCLCDB/redo01.log' SCN MIN 22541459 SCN MAX 22541459 OBJNO 76069;

System DUMP altered.

对应的Trace log文件片段:

REDO RECORD - Thread:1 RBA: 0x0000c7.00007940.0168 LEN: 0x0194 VLD: 0x01 CON_UID: 1574565078
SCN: 0x000000000157f493 SUBSCN:  2 12/19/2021 08:33:26
CHANGE #1 CON_ID:3 TYP:0 CLS:31 AFN:11 DBA:0x024000f0 OBJ:4294967295 SCN:0x000000000157f46d SEQ:1 OP:5.2 ENC:0 RBL:0 FLG:0x0000
ktudh redo: slt: 0x000a sqn: 0x000087b2 flg: 0x0052 siz: 112 fbi: 0
            uba: 0x0240030e.035a.06    pxid:  0x0000.000.00000000        pdbuid:1574565078
CHANGE #2 CON_ID:3 TYP:0 CLS:32 AFN:11 DBA:0x0240030e OBJ:4294967295 SCN:0x000000000157f468 SEQ:2 OP:5.1 ENC:0 RBL:0 FLG:0x0000
ktudb redo: siz: 112 spc: 7548 flg: 0x0012 seq: 0x035a rec: 0x06
            xid:  0x0008.00a.000087b2
ktubl redo: slt: 10 wrp: 1 flg: 0x0c08 prev dba:  0x00000000 rci: 0 opc: 11.1 [objn: 76069 objd: 76069 tsn: 5]
[Undo type  ] Regular undo  [User undo done   ]  No  [Last buffer split]  No
[Temp object]           No  [Tablespace Undo  ]  No  [User only        ]  No
Begin trans
 prev ctl uba: 0x0240030e.035a.04 prev ctl max cmt scn:  0x000000000157ea1d
 prev tx cmt scn:  0x000000000157ea25
 txn start scn:  0xffffffffffffffff  logon user: 113
 prev brb:  0x0240030c  prev bcl:  0x00000000
BuExt idx: 0 flg2: 0
...

flag为4表示checksum present。2则表示block cleaned。

SQL> show parameter db_block_checksum;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_block_checksum                    string      TYPICAL

chkval为block checksum。DB_BLOCK_CHECKSUM帮助见这里

DB_BLOCK_CHECKSUM determines whether DBWn and the direct loader will calculate a checksum (a number calculated from all the bytes stored in the block) and store it in the cache header of every data block when writing it to disk.
Checksums allow Oracle to detect corruption caused by underlying disks, storage systems, or I/O systems.
Turning on this feature in TYPICAL mode causes only an additional 1% to 2% overhead. In the FULL mode it causes 4% to 5% overhead. Oracle recommends that you set DB_BLOCK_CHECKSUM to TYPICAL.
Checksums are verified when a block is read - only if this parameter is TYPICAL or FULL and the last write of the block stored a checksum.

最后一个字段为tail,4个字节,0xf4930602

全表扫描(Full Scan)包括以下步骤:

  1. read segment header
  2. read extent map blocks (Extent Map部分)
  3. read data

来看一下data block部分:

Block header dump:  0x0303ddb4
 Object id on Block? Y
 seg/obj: 0x12925  csc:  0x000000000157f493  itc: 2  flg: E  typ: 1 - DATA
     brn: 0  bdba: 0x303ddb0 ver: 0x01 opc: 0
     inc: 0  exflg: 0

 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0008.00a.000087b2  0x0240030e.035a.06  --U-    1  fsc 0x0000.0157f499
0x02   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
bdba: 0x0303ddb4
data_block_dump,data header at 0x7f56c9b4c064
===============
tsiz: 0x1f98
hsiz: 0x14
pbl: 0x7f56c9b4c064
     76543210
flag=--------
ntab=1
nrow=1
frre=-1
fsbo=0x14
fseo=0x1f88
avsp=0x1f74
tosp=0x1f74
0xe:pti[0]      nrow=1  offs=0
0x12:pri[0]     offs=0x1f88
block_row_dump:
tab 0, row 0, @0x1f88
tl: 16 fb: --H-FL-- lb: 0x1  cc: 3
col  0: [ 2]  c1 0b
col  1: [ 2]  c1 0b
col  2: [ 6]  43 6f 6e 6e 6f 72
end_of_block_dump

其中字段的说明如下:

  • tsiz:total size,0x1f98即8088。block size为8192。
  • hsize:header size,0x14即20
  • bdba:block database address
  • ntab:表示此数据块只为一个表所用。多个表所用的情形为cluster table。
  • nrow:此数据块只包含1行。
  • frre:free row pointer
  • fseo:free space begin
  • avsp:available free space
  • tosp:total free space。如果删除了块中的一些行,tosp会增加,但avsp仍然只是上部的空间。
  • 0xe:pti[0]:有多少行,row directory的位置
  • 0x12:pri[0]:第一行所在的位置,可以看出,第1行反而在底部。
  • tl:total row length,为16。
  • cc:column count,为3

col 0, col 1, col 2部分就是实际的数据了,也可以用以下的SQL验证:

SQL> SELECT x, vsize(x), dump(x) FROM T;

    X    VSIZE(X)                DUMP(X)
_____ ___________ ______________________
   10           2 Typ=2 Len=2: 193,11

问题是此行为16字节,而这几个字段加起来合计10字节,其它部分应该是用来存字段长度,每行的长度和此行的锁信息等。

事务

多个事务修改同一数据块时,未必会引发锁,除非修改同一行的数据。

以下是data block中的一部分:

Block header dump:  0x0303ddb4
 Object id on Block? Y
 seg/obj: 0x12925  csc:  0x000000000157f493  itc: 2  flg: E  typ: 1 - DATA
     brn: 0  bdba: 0x303ddb0 ver: 0x01 opc: 0
     inc: 0  exflg: 0

 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0008.00a.000087b2  0x0240030e.035a.06  --U-    1  fsc 0x0000.0157f499
0x02   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000

seg/obj为对象ID,0x12925即76069;csc表示commit/cleanout SCN;itc表示interested transaction (slot) count;flg即flag,O表示not full,E表示empty;typ表示是哪一类的数据,如data,index。

之后的两行显示Interested transaction list(slot),和itc一致。其中Xid表示Transaction ID,由undo#,slot#和seq# 三部分组成。Uba表示undo block address,由rdba,row#和sequence#组成。Lck表示锁定了多少行;Scn/Fsc表示SCN或free space credit;Flag表示事务的状态,U表示commited,unclean。

对于每一行,都有一个lock表示,长度为1字节,因此可以有255个取值,表示255个itl。也就是说,一个block上最多可以同时有255个事务。
实际上,在create table语句中,可以指定initrans和maxtrans。参考这里

参考

  • https://connormcdonald.podbean.com/

以上是关于Oracle数据库块之旅的主要内容,如果未能解决你的问题,请参考以下文章

逆袭之旅DAY16.东软实训.Oracle.匿名块

python学习之旅-06 之小数据池,编码

音视频开发之旅(58) -H.264 帧内预测

音视频开发之旅(58) -H.264 帧内预测

小白之旅19

JAVA之旅——this,static,关键字,main函数,封装工具类,生成javadoc说明书,静态代码块