- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
19#
发表于 2012-3-12 10:12:55
redo 中change record里的uba, 其主要目的同样是为了 前滚 rolling forward:
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> select * from global_name;
GLOBAL_NAME
--------------------------------------------------------------------------------
www.oracledatabase12g.com
SQL> Alter database add supplemental log data;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> select * from v$Log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 41 52428800 2 NO CURRENT 15356105 12-MAR-12
2 1 40 52428800 2 YES INACTIVE 15356103 12-MAR-12
3 1 39 52428800 2 YES INACTIVE 15355949 12-MAR-12
SQL> create table simu_change (mac1 varchar2(200));
Table created.
SQL> select dump('I AM RECORD HAS BEEN CHANGED',16) from dual;
DUMP('IAMRECORDHASBEENCHANGED',16)
--------------------------------------------------------------------------------
Typ=96 Len=28: 49,20,41,4d,20,52,45,43,4f,52,44,20,48,41,53,20,42,45,45,4e,20,43
,48,41,4e,47,45,44
SQL> insert into simu_change values('I AM RECORD HAS BEEN CHANGED');
1 row created.
SQL> alter system checkpoint;
System altered.
SQL> select header_file,header_block from dba_segments where segment_name='SIMU_CHANGE';
HEADER_FILE HEADER_BLOCK
----------- ------------
1 250993
SQL> alter system dump datafile 1 block 250994;
System altered.
SQL> oradebug setmypid;
Statement processed.
SQL> oradebug tracefile_name;
/s01/admin/G10R21/udump/g10r21_ora_22373.trc
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0008.001.00000db8 0x0480017f.036d.05 ---- 1 fsc 0x0000.00000000
0x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
data_block_dump,data header at 0x798a65c
===============
tsiz: 0x1fa0
hsiz: 0x14
pbl: 0x0798a65c
bdba: 0x0043d472
76543210
flag=--------
ntab=1
nrow=1
frre=-1
fsbo=0x14
fseo=0x1f80
avsp=0x1f6c
tosp=0x1f6c
0xeti[0] nrow=1 offs=0
0x12ri[0] offs=0x1f80
block_row_dump:
tab 0, row 0, @0x1f80
tl: 32 fb: --H-FL-- lb: 0x1 cc: 1
col 0: [28]
49 20 41 4d 20 52 45 43 4f 52 44 20 48 41 53 20 42 45 45 4e 20 43 48 41 4e
47 45 44
end_of_block_dump
End dump data blocks tsn: 0 file#: 1 minblk 250994 maxblk 250994
SQL> alter system dump logfile '/s01/oradata/G10R21/onlinelog/o1_mf_1_7ch812dg_.log';
System altered.
转储current logfile
SQL> oradebug setmypid;
Statement processed.
SQL> oradebug tracefile_name;
/s01/admin/G10R21/udump/g10r21_ora_22378.trc
找到 INSERT 对应的change record
REDO RECORD - Thread:1 RBA: 0x000029.0000000d.0140 LEN: 0x01c0 VLD: 0x01
SCN: 0x0000.00ea50e0 SUBSCN: 4 03/12/2012 13:56:56
...................................................
CHANGE #3 TYP:0 CLS: 1 AFN:1 DBA:0x0043d472 OBJ:56082 SCN:0x0000.00ea50e0 SEQ: 3 OP:11.2
KTB Redo
op: 0x01 ver: 0x01
op: F xid: 0x0008.001.00000db8 uba: 0x0480017f.036d.05
KDO Op code: IRP row dependencies Disabled
xtype: XA flags: 0x00000000 bdba: 0x0043d472 hdba: 0x0043d471
itli: 1 ispac: 0 maxfr: 4863
tabn: 0 slot: 0(0x0) size/delt: 32
fb: --H-FL-- lb: 0x1 cc: 1
null: -
col 0: [28]
49 20 41 4d 20 52 45 43 4f 52 44 20 48 41 53 20 42 45 45 4e 20 43 48 41 4e
47 45 44
这里的 xid 和uba 用来 rolling forward (or recovery) block header中的 ITL , 一条ITL 包含了 XID 和 UBA 记录:
xid: 0x0008.001.00000db8 uba: 0x0480017f.036d.05 itli: 1
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0008.001.00000db8 0x0480017f.036d.05 ---- 1 fsc 0x0000.00000000
如果redo 只记录 变化的数据如 op code :INSERT DATA: 49 20 41 4d 20 52 45 43 4f 52 44 20 48 41 53 20 42 45 45 4e 20 43 48 41 4e 47 45 44, 显然不足以物理上恢复整个块。
所以 uba 和 xid 对前滚是必要的。 |
|