从Undo, Redo, DataFile看Oracle中的事务过程
2009-06-12 11:51:00 来源:WEB开发网查看当前活动的redo log,
SQL> select log.group#, log.status, logfile.member
2 from v$log log, v$logfile logfile
3 where log.group#=logfile.group#;
GROUP# STATUS MEMBER
---------- ---------------- ----------------------------------------
1 INACTIVE D:\ORACLE\ORADATA\TESTDB\REDO01.LOG
2 CURRENT D:\ORACLE\ORADATA\TESTDB\REDO02.LOG
3 INACTIVE D:\ORACLE\ORADATA\TESTDB\REDO03.LOG
SQL> alter system dump logfile 'D:\ORACLE\ORADATA\TESTDB\REDO02.LOG' scn min 41683588 scn max 41684393;
System altered.
Redo中对于一个transaction的改变向量纪录如下
REDO RECORD - Thread:1 RBA: 0x00008a.000004a2.0010 LEN: 0x0190 VLD: 0x01
SCN: 0x0000.027c0b03 SUBSCN: 1 06/11/2009 15:01:35
CHANGE #1 TYP:0 CLS:35 AFN:2 DBA:0x00800099 SCN:0x0000.027c09bb SEQ: 1 OP:5.2<----Update rollback segment header - KTURDH
ktudh redo: slt: 0x001b sqn: 0x00005147 flg: 0x0012 siz: 104 fbi: 0
uba: 0x0080055f.05c1.2d pxid: 0x0000.000.00000000
CHANGE #2 TYP:0 CLS:36 AFN:2 DBA:0x0080055f SCN:0x0000.027c09ba SEQ: 1 OP:5.1<----Undo block or undo segment header - KTURDB
ktudb redo: siz: 104 spc: 4278 flg: 0x0012 seq: 0x05c1 rec: 0x2d
xid: 0x000a.01b.00005147
ktubl redo: slt: 27 rci: 0 opc: 11.1 objn: 30387 objd: 30387 tsn: 0
Undo type: Regular undo Begin trans Last buffer split: No
Temp Object: No
Tablespace Undo: No
0x00000000 prev ctl uba: 0x0080055f.05c1.2c
prev ctl max cmt scn: 0x0000.0277854e prev tx cmt scn: 0x0000.02778558
KDO undo record:
KTB Redo
op: 0x03 ver: 0x01
op: Z
KDO Op code: URP row dependencies Disabled
xtype: XA bdba: 0x0040c732 hdba: 0x0040c731
itli: 2 ispac: 0 maxfr: 4863
tabn: 0 slot: 0(0x0) flag: 0x2c lock: 0 ckix: 0
ncol: 1 nnew: 1 size: 0
col 0: [ 3] c2 02 18
CHANGE #3 TYP:2 CLS: 1 AFN:1 DBA:0x0040c732 SCN:0x0000.027c094a SEQ: 1 OP:11.5<----Update Row Piece
KTB Redo
op: 0x11 ver: 0x01
op: F xid: 0x000a.01b.00005147 uba: 0x0080055f.05c1.2d
Block cleanout record, scn: 0x0000.027c0b03 ver: 0x01 opt: 0x02, entries follow...
itli: 1 flg: 2 scn: 0x0000.027c094a
KDO Op code: URP row dependencies Disabled
xtype: XA bdba: 0x0040c732 hdba: 0x0040c731
itli: 2 ispac: 0 maxfr: 4863
tabn: 0 slot: 0(0x0) flag: 0x2c lock: 2 ckix: 0
ncol: 1 nnew: 1 size: 0
col 0: [ 3] c2 05 39
CHANGE #4 MEDIA RECOVERY MARKER SCN:0x0000.00000000 SEQ: 0 OP:5.20<----Transaction continue audit log record
session number = 9
serial number = 10
transaction name =
......
CHANGE #1 TYP:0 CLS:35 AFN:2 DBA:0x00800099 SCN:0x0000.027c0b03 SEQ: 1 OP:5.4<----Commit transaction
ktucm redo: slt: 0x001b sqn: 0x00005147 srt: 0 sta: 9 flg: 0x2
ktucf redo: uba: 0x0080055f.05c1.2d ext: 2 spc: 4172 fbi: 0
从上面的过程来看,
Undo:分配事务槽及记录数据前镜像。
DataFile:记录事务信息及修改后的数据。
Redo:记录事务槽分配、回滚段信息、修改后数据信息、事务提交信息等。
更多精彩
赞助商链接