alter tablespace XXX begin backup;cp XXX ....alter tablespace XXX end backup; |
SQL> select name,value from v$sysstat where name='redo size';NAME VALUE--------------------------------------------------- ----------redo size 43408SQL> update test set a=a;1 row updated.SQL> commit;Commit complete.SQL> select name,value from v$sysstat where name='redo size';NAME VALUE--------------------------------------------------------------redo size 44060 SQL> ALTER SYSTEM DUMP LOGFILE '/netappredo/redo05.log';System altered. |
SQL> alter tablespace test begin backup;Tablespace altered.SQL> select name,value from v$sysstat where name='redo size';NAME VALUE------------------------------------------------------------------redo size 44732SQL> update test set a=a;1 row updated.SQL> commit;Commit complete.SQL> select name,value from v$sysstat where name='redo size';NAME VALUE-------------------------------------------------------------------redo size 53560SQL> alter tablespace test end backup;Tablespace altered. |
SQL> ALTER SYSTEM DUMP LOGFILE '/netappredo/redo05.log';System altered.REDO RECORD - Thread:2 RBA: 0x00004e.000000b0.0128 LEN: 0x01b0 VLD: 0x01SCN: 0x0000.19ed24f7 SUBSCN: 1 06/29/2004 15:05:32CHANGE #1 TYP:0 CLS:29 AFN:33 DBA:0x08400029 SCN:0x0000.19ed24f2 SEQ: 1 OP:5.2...... (改动向量1,记载对undo header事务表的修改)CHANGE #2 TYP:0 CLS:30 AFN:33 DBA:0x0840002e SCN:0x0000.19ed24f0 SEQ: 1 OP:5.1...... (改动向量2,记载对undo block的修改)CHANGE #3 TYP:2 CLS: 1 AFN:51 DBA:0x0cc0000f SCN:0x0000.19ed24e8 SEQ: 1 OP:11.5KTB Redo (改动向量3,记载对数据块的修改,也就是在数据块上执行update test set a=a)op: 0x11 ver: 0x01 op: F xid: 0x0007.001.00014ece uba: 0x0840002e.0859.38Block cleanout record, scn: 0x0000.19ed24f7 ver: 0x01 opt: 0x02, entries follow... itli: 1 flg: 2 scn: 0x0000.19ed24e8KDO Op code: URP row dependencies Disabled xtype: XA bdba: 0x0cc0000f hdba: 0x0cc0000bitli: 2 ispac: 0 maxfr: 4858tabn: 0 slot: 0(0x0) flag: 0x2c lock: 2 ckix: 0ncol: 1 nnew: 1 size: 0col 0: [ 2] c1 02CHANGE #4 MEDIA RECOVERY MARKER SCN:0x0000.00000000 SEQ: 0 OP:5.20......(改动向量4,一些标记) |
Log block image redo entryDump of memory from 0x0AE48820 to 0x0AE4A808AE48820 00280001 00002C32 19ED24E6 1FE80000 [..(.2,...$......]AE48830 00321F02 0CC00009 00210005 000307F1 [..2.......!.....]AE48840 0840000E 0021100C 00002001 19ED24E8 [..@...!.. ...$..]AE48850 001F0016 0001A94C 0840007C 000D0C08 [....L...|.@.....]AE48860 00008000 19ED2468 00000000 00000000 [....h$..........]AE48870 00020100 00160001 1F791F8C 00001F79 [..........y.y...]AE48880 1F920002 0F88FFFF 0ED00F2C 0E180E74 [........,...t...]AE48890 0D600DBC 0CA80D04 0BF00C4C 0B380B94 [..`.....L.....8.]AE488A0 0A800ADC 09C80A24 0910096C 085808B4 [....$...l.....X.]AE488B0 07A007FC 06E40744 06240684 056405C4 [....D.....$...d.]...... |
这就又牵扯到一个概念,'block split',当数据文件在备份cp时,因为oracle数据块和操作系统块的差异,一个数据块可能由16个操作系统块组成(8k 数据块,512bytes 系统块),这样的话可能出现一个数据块包含了几个不同版本的操作系统块,会导致数据块的不一致,所以在备份模式下如果有语句对备份块产生更新,那么oracle会先把当前块复制一份到redo,当恢复的时候如果碰到数据块不一致就从redo把这个镜像拷贝回去,然后在这个一致性的镜像开始恢复。 如果使用rman来备份可以避免产生过多的块,就像上面所说的,rman会去建议块的一致性,所以不用复制镜像块到日志。