注意:这里我们要删除dept表上的主键约束,否则,因为有索引,生成的重做会更多,更复杂。
21:36:24 SQL> conn law/law
已连接。
21:37:33 SQL> alter system switch logfile;
系统已更改。
21:38:04 SQL> select group#,status from v$log;
GROUP# STATUS
---------- -----------
1 CURRENT
2 ACTIVE
3 INACTIVE
21:38:10 SQL> insert into dept values(7,'E','E');
已创建 1 行。
21:38:31 SQL> alter system switch logfile;
系统已更改。
21:38:43 SQL> alter system dump logfile 'E:ORACLEPRODUCT10.2.0ORADATALAWREDO01.LOG';
系统已更改。
21:38:50 SQL> select object_id from dba_objects
21:39:13 2 where object_name='DEPT'
21:39:21 3 /
OBJECT_ID
----------
13245
在导出文件中查找“13245”,可以发现如下信息:
REDO RECORD - Thread:1 RBA: 0x00009f.0000000a.0010 LEN: 0x01d8 VLD: 0x0d
SCN: 0x0000.002c2494 SUBSCN: 1 05/31/2006 21:38:43
CHANGE #1 TYP:2 CLS: 1 AFN:4 DBA:0x0100004d OBJ:13245 SCN:0x0000.002c2345 SEQ: 1 OP:11.2
KTB Redo
op: 0x11 ver: 0x01
op: F xid: 0x0005.000.000004e7 uba: 0x008016bf.0062.30
Block cleanout record, scn: 0x0000.002c248b ver: 0x01 opt: 0x02, entries follow...
itli: 1 flg: 2 scn: 0x0000.002c1b8d
itli: 2 flg: 2 scn: 0x0000.002c2345
KDO Op code: IRP row dependencies Disabled
xtype: XA flags: 0x00000000 bdba: 0x0100004d hdba: 0x0100004b
itli: 1 ispac: 0 maxfr: 4858
tabn: 0 slot: 3(0x3) size/delt: 10
fb: --H-FL-- lb: 0x1 cc: 3
null: ---
col 0: [ 2] c1 08 这是我们添加的记录
col 1: [ 1] 45
col 2: [ 1] 45
CHANGE #2 TYP:0 CLS:25 AFN:2 DBA:0x00800049 OBJ:4294967295 SCN:0x0000.002c244c SEQ: 1 OP:5.2
ktudh redo: slt: 0x0000 sqn: 0x000004e7 flg: 0x0012 siz: 128 fbi: 0
uba: 0x008016bf.0062.30 pxid: 0x0000.000.00000000
CHANGE #3 TYP:0 CLS:26 AFN:2 DBA:0x008016bf OBJ:4294967295 SCN:0x0000.002c244b SEQ: 3 OP:5.1
ktudb redo: siz: 128 spc: 1844 flg: 0x0012 seq: 0x0062 rec: 0x30
xid: 0x0005.000.000004e7
ktubl redo: slt: 0 rci: 0 opc: 11.1 objn: 13245 objd: 13245 tsn: 4
Undo type: Regular undo Begin trans Last buffer split: No
Temp Object: No
Tablespace Undo: No
0x00000000 prev ctl uba: 0x008016bf.0062.2d
prev ctl max cmt scn: 0x0000.002c1f50 prev tx cmt scn: 0x0000.002c1f51
txn start scn: 0x0000.002c2493 logon user: 44 prev brb: 8394426 prev bcl: 0 KDO undo record:
KTB Redo
op: 0x04 ver: 0x01
op: L itl: xid: 0x0006.020.000004e1 uba: 0x00801382.00f5.37
flg: C--- lkc: 0 scn: 0x0000.002c1b8d
KDO Op code: DRP row dependencies Disabled
xtype: XA flags: 0x00000000 bdba: 0x0100004d hdba: 0x0100004b
itli: 1 ispac: 0 maxfr: 4858
tabn: 0 slot: 3(0x3)
RBA:Relative Byte Address ,日志序号,块号,字节序号
TYP:change type
CLS:block class
AFN:absolute file number
DBA:data block address
如果change不是针对一个具体的数据块,AFN及DBA都可以为0
结论:insert语句生成了一条redo record,由3个change vector构成。