Oracle redo日志文件分析(insert)
1:记录当前scn
select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
1159572
2:创建表
CREATE TABLE team ( team_code VARCHAR2(3), team_name VARCHAR2(30), country_code VARCHAR2(3) ); INSERT INTO team VALUES ('MCL','McLaren','GBR'); COMMIT; 2:记录当前scn
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
1159601
3:通过scnscn 转储
alter system dump logfile '/u01/app/oracle/oradata/devdb/redo01.log' scn min 1159572 scn max 1159601
4:文件分析
REDO RECORD - Thread:1 RBA: 0x000019.00000fef.0010 LEN: 0x01e8 VLD: 0x0d
SCN: 0x0000.0011b1a0 SUBSCN: 1 06/03/2016 15:18:11
THEREAD: 线程号1;
RBA: 序列号+块号+块里字节号
LEN:长度
VLD:
SCN:改变时间
select to_number('1195A5','xxxxxx') from dual 16to10
select to_char(scn_to_timestamp(1159584),'YYYY-MM-DD HH24:MI:SS') from dual;
select timestamp_to_scn(to_date('2016-03-06 15:18:15','YYYY-MM-DD HH24:MI:SS')) from dual;
CHANGE #1 TYP:0 CLS:1 AFN:5 DBA:0x014000a5 OBJ:73445 SCN:0x0000.0011aa1f SEQ:2 OP:11.2 ENC:0 RBL:0
KTB Redo
op: 0x01 ver: 0x01
compat bit: 4 (post-11) padding: 1
op: F xid: 0x0006.01a.00000313 uba: 0x00c00a6a.00a7.39
KDO Op code: IRP row dependencies Disabled
xtype: XA flags: 0x00000000 bdba: 0x014000a5 hdba: 0x014000a2
itli: 1 ispac: 0 maxfr: 4858
tabn: 0 slot: 0(0x0) size/delt: 19
fb: --H-FL-- lb: 0x1 cc: 3
null: ---
col 0: [ 3] 4d 43 4c
col 1: [ 7] 4d 63 4c 61 72 65 6e
col 2: [ 3] 47 42 52
change #1 改变数
TYP:0 改变类型
CLS:1 参照X$BH class 1表示数据块
AFN:绝对数据文件号 5
DBA:更改数据块地址 14000a5(5/165)
OBJ: object id
SCN:0x0000.0011aa1f
seq:2:序列号
OP:11.2 Insert Row Piece
KTB REDO
op: 01 F
xid: 0x0006.01a.00000313 transaction ID
uba: 0x00c00a6a.00a7.39 回滚段改变地址,序列号,块记录号
KDO: IRP(Insert Row Piece) row dependencies Disabled (默认创建表示非依赖,启动特性,ORA_ROWSCN伪列新特性)
bdba:block address
hdba:segment header address
itli:事务slot 1
tabn: 0 表示非群集表
slot: 0(0x0) slot number
size/delt: 19 块改变大小,增加19 bytes
fb: --H-FL--
lb: 0x1 被锁住事务itil 1(与上面相符)
cc: 3 插入列的数量
col 0: [ 3] 4d 43 4c
col 1: [ 7] 4d 63 4c 61 72 65 6e
col 2: [ 3] 47 42 52
以上插入数值