oracle-REDO日志文件分析(insert),oracle-redoinsert
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
以上插入數值