了解Oracle Deferred Rollback/Undo Segments

查dba_segments可以看到一种独特的SEGMENT类型 即DEFERRED ROLLBACK:

  1* select segment_name,segment_type from dba_segments where segment_type='DEFERRED ROLLBACK'
SQL> /

SEGMENT_NAME                   SEGMENT_TYPE
------------------------------ ------------------
1.12928                        DEFERRED ROLLBACK
1.21840                        DEFERRED ROLLBACK
1.30040                        DEFERRED ROLLBACK

 

这些DEFERRED ROLLBACK也叫做SAVE Undo segments,具有以下的特性:

  • 其存在是为了那些突然OFFLINE掉的表空间上的活跃事务存放UNDO/Rollback回滚数据
  • Segment_name数据段的名字为FILE#文件号.Block#块号
  • 其SEGMENT_TYPE是DEFERRED ROLLBACK
  • 一般自动创建在SYSTEM表空间上
  • 属于SYS用户
  • 如果OFFLINE掉的表空间重新ONLINE且undo数据已经被应用则会被自动DROP掉

 

Deferred Undo Segments是特殊用途的回滚段,其中的undo数据不同于undo表空间上的数据结构,以一种简单的顺序日志形式存在。其SEGMENT_NAME为FILE#.Block#,对应其段头segment header的物理位置。

从DBA_SEGMENTS查的话就是SEGMENT_TYPE为DEFERRED ROLLBACK的数据段,一般存在SYSTEM表空间上,且属于SYS用户。  有用户遇到过OFFLINE掉几个表空间后,SYSTEM表空间急速膨胀,最后查出来就是被这些DEFERRED ROLLBACK回滚段占用了空间。

DEFERRED ROLLBACK的数据结构就是简单的顺序存放着,而没有对齐或者填充,这一点和普通的undo是不同的。

下面是与Save Undo/DEFERRED ROLLBACK相关的事件:

10023 – Create Save Undo Segment
10024 – Write to Save Undo Segment
10025 – Extend Save Undo Segment
10026 – Apply Save Undo

 

 

alter system dump datafile 1 block 12928;

alter system dump datafile 1 block 12929;

SQL> oradebug setmypid
Statement processed.
SQL> oradebug tracefile_name
/s01/diag/rdbms/asmdb1/ASMDB1/trace/ASMDB1_ora_30355.trc

buffer tsn: 0 rdba: 0x00403281 (1/12929)
scn: 0x0000.001859e0 seq: 0x01 flg: 0x04 tail: 0x59e00401
frmt: 0x02 chkval: 0x8f39 type: 0x04=KTT SAVE UNDO BLOCK
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x00007F735FF94A00 to 0x00007F735FF96A00
7F735FF94A00 0000A204 00403281 001859E0 04010000  [[email protected]......]
7F735FF94A10 00008F39 00001FE4 00000000 00000000  [9...............]
7F735FF94A20 00000000 00000000 00000000 00000000  [................]
        Repeat 508 times
7F735FF969F0 00000000 00000000 00000000 59E00401  [...............Y]
  SUN BLK:: sbk: 8164   nrc: 0
End dump data blocks tsn: 0 file#: 1 minblk 12929 maxblk 12929

 


Posted

in

by

Tags:

Comments

One response to “了解Oracle Deferred Rollback/Undo Segments”

  1. […] 了解Oracle Deferred Rollback/Undo Segments 查dba_segments可以看到一种独特的SEGMENT类型 即DEFERRED ROLLBACK: 1* […]… […]

Leave a Reply

Your email address will not be published. Required fields are marked *