模糊位和恢复
ALTER SESSION SET EVENTS 'immediate trace name file_hdrs level 10'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (From Oracle 11.2.x) *DUMP OF DATA FILES: 209 files in database *DATA FILE #1: ------------ NB: Here down is the control file info --------- name #7: /grdbms/64bit/app/oracle/oradata/S112W6/system01.dbf creation size=0 block size=8192 status=0xe head=7 tail=7 dup=1 ==> ^^^^(kcc3.h) KCCFEFDB 0x0001 /* file read-only, plugged from foreign DB */ KCCFEONL 0x0002 /* file is ONLine */ KCCFERDE 0x0004 /* ReaDing is Enabled */ KCCFECGE 0x0008 /* ChanGing is Enabled */ KCCFEMRR 0x0010 /* Media Recovery Required */ KCCFEGEM 0x0020 /* Generate End hot backup Marker at next open */ KCCFECKD 0x0040 /* File record generated by check dictionary */ KCCFESOR 0x0080 /* Save Offline scn Range at next checkpoint */ KCCFERMF 0x0100 /* Renamed Missing File */ KCCFEGOI 0x0200 /* Generate Off-line Immediate marker */ KCCFECUV 0x0400 /* Checkpoint by instance where UnVerified */ KCCFEDRP 0x0800 /* offline to be DRoPped */ KCCFEODC 0x2000 /* Online at Dictionary Check if read/only tblspc */ KCCFEDBR 0x4000 /* entry created by DBMS_BACKUP_RESTORE */ KCCFETRO 0x8000 /* Transition Read Only */define KCCFEWCC 0x1000 /* tablespace 0, index=1 krfil=1 prev_file=0 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00 Checkpoint cnt:254 scn: 0x0008.2fc2fcfc 05/29/2012 08:38:57 Stop scn: 0xffff.ffffffff 05/28/2012 22:12:14 ==> ^^^Stop=ffff implies OPEN,ABORT or WARM Creation Checkpointed at scn: 0x0000.00000007 09/05/2010 05:49:14 thread:0 rba:(0.0.0) enabled threads: 00000000 00000000 00000000 00000000 00000000 00000000 ... Offline scn: 0x0000.000edcac prev_range: 0 Online Checkpointed at scn: 0x0000.000edcad 04/19/2012 12:47:48 thread:1 rba:(0x1.2.0) enabled threads: 01000000 00000000 00000000 00000000 00000000 00000000 Hot Backup end marker scn: 0x0000.00000000 aux_file is NOT DEFINED Plugged readony: NO Plugin scnscn: 0x0000.00000000 Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988 00:00:00 Foreign creation scn/timescn: 0x0000.00000000 01/01/1988 00:00:00 Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988 00:00:00 Online move state: 0 * V10 STYLE FILE HEADER: ------------Here down is from the file header------------------ Compatibility Vsn = 186647040=0xb200200 ^^^ Oldest Usable Oracle Vers Db ID=4057569686=0xf1d99996, Db Name='S112W6' Activation ID=0=0x0 Control Seq=4800=0x12c0, File size=129280=0x1f900 ==> ^^^ Should be <= to Seq# in control file. File Number=1, Blksiz=2048, File Type=3 ==> ^^^^^^^^^^^(kcc4.h) KCCTYPCF 1 /* control file */ KCCTYPRL 2 /* redo log file */ KCCTYPDF 3 /* vanilla db file */ KCCTYPBC 4 /* backup control file */ KCCTYPBP 5 /* backup piece */ KCCTYPTF 6 /* temporary db file */ KCCTYPCT 7 /* change tracking file */ KCCTYPFL 8 /* flashback database log file */ KCCTYPAL 9 /* archivelog file */ KCCTYPDC 10 /* datafile copy file */ KCCTYPIR 11 /* incompletely restored db file */ KCCTYPEL 12 /* foreign archivelog file */ KCCTYPLB 13 /* LOB */ Tablespace #0 - SYSTEM rel_fn:1 Creation at scn: 0x0000.00000007 09/05/2010 05:49:14 Backup taken at scn: 0x0000.00000000 01/01/1988 00:00:00 thread:0 ==>^^^^^ Last ALTER TABLESPACE BEGIN BACKUP reset logs count:0x2e8d5a74 scn: 0x0000.000edcad ==>^^^^^ Last ALTER DATABASE OPEN RESETLOGS prev reset logs count:0x2b920186 scn: 0x0000.000ed5f2 recovered at 05/14/2012 07:41:07 status:0x2004 root dba:0x00400208 chkpt cnt: 254 ctl cnt:253 ==>^^^^^ (kcv3.h) KCVFHHBP 0x01 /* hotbackup-in-progress on file (fuzzy file) */ KCVFHOFZ 0x04 /* Online FuZzy because it was online and db open */ KCVFHMFZ 0x10 /* Media recovery FuZzy - file in media recovery */ KCVFHAFZ 0x40 /* Absolutely FuZzy - fuzzyness from file scan */ KCVFH_FUZZY (KCVFHHBP|KCVFHOFZ|KCVFHMFZ|KCVFHAFZ|KCVFHPCP|KCVFHSBY) KCVFH_OOFUZZY (KCVFHHBP|KCVFHMFZ|KCVFHAFZ|KCVFHPCP|KCVFHSBY) KCVFH_NMFUZZY (KCVFH_FUZZY^KCVFHMFZ^KCVFHSBY) /* non-MR fuzzy */ KCVFHBCP 0x100 /* Bad Checkpoint - no enabled thread bitvec */ KCVFHFMH 0x200 /* Freshly Munged Header. resetlogs not finished */ KCVFHXCH 0x400 /* eXternally CacHed by operating system */ KCVFHZBA 0x800 /* Zeroed Blocks Allowed */ KCVFHPCP 0x1000 /* Proxy Copy in Progress */ KCVFHRBS 0x2000 /* does kcvfhrdb point to bootstrap$ ? */ KCVFHSBY 0x4000 /* media rcv fuzzy due to standby apply */ KCVFHL0C 0x8000 /* Incremental level 0 copy */ begin-hot-backup file size: 0 Checkpointed at scn: 0x0008.2fc2fcfc 05/29/2012 08:38:57 ==>^^^^^ Last Datafile checkpoint & its REDO address. thread:1 rba:(0x2e.34cb.10) enabled threads: 01000000 00000000 00000000 00000000 00000000 00000000 ==>^^^^^^ Threads of redo - thread 1 in use here External cache id: 0x0 0x0 0x0 0x0 Absolute fuzzy scn: 0x0000.00000000 Recovery fuzzy scn: 0x0000.00000000 01/01/1988 00:00:00 Terminal Recovery Stamp 01/01/1988 00:00:00 Platform Information: Creation Platform ID: 13 Current Platform ID: 13 Last Platform ID: 13 ==> ^^^^^^^^^ Check whether datafile has been transported from another platform (splatform.h) 1 Solaris 32-bit 2 Solaris 64-bit 3 HP-UX (64-bit) 4 HP-UX IA (64-bit) 5 HP Tru64 UNIX 6 AIX-Based Sysetms (64-bit) 7 Microsoft Windows IA (32-bit) 8 Microsoft Windows IA (64-bit) 9 IBM zSeries Based Linux 10 Linux IA (32-bit) 11 Linux IA (64-bit) 12 Microsoft Windows x86 64-bit) 13 Linux x86 64-bit 14 IBM z/OS 15 HP Open VMs 16 Apple Mac OS 17 Solaris Operating System (x86) 18 IBM Power Based Linux 19 HP IA Open VMS 20 Solaris Operating System (x86-64) 21 Apple Mac OS (x86-64)
在数据文件头中的任何模糊位意味着,这个数据文件包含了SCN大于检查点的SCN的块。下面有4类型的模糊位存在于数据文件头。
1.在线 模糊(online fuzzy)
这个位被设置当数据库文件在正常数据库打开时。其被设置是因为DBWR可以写块从SGA到数据文件。这样会导致SCN可能在某些场合高于检查点SCN。其会在下面场景清理:
–数据文件关闭
–热备 fuzzy设置
–结束灾难恢复或结束结束恢复达到时
2.Hotbackup-Fuzzy
当执行alter tablespace begin backup命令的时候被设置。数据库文件头将被冻结并且块中包含SCN高于检查点SCN
当下面场景时清理:
–alter tablespace end backup或
Alter database end backup或
Alter database datafile 发布 end backup。结束灾难恢复或结束结束恢复达到时
3.介质恢复-Fuzzy
这个位在每个文件经历恢复开始恢复时被设置,并且其表明随着介质恢复进行,文件将包含当前头检查点后来的变更。
一般情况下,介质恢复模糊位可以在介质恢复检查点推荐到数据文件头时清理。
它们会在介质恢复会话成功完成或取消时被清理。
4.绝对模糊
当数据库是open状态,并且使用RMAN进行备份时,块发生变化时,绝对模糊位和绝对模糊SCN会被设置(热备)。在其他情况下的备份不会设置绝对模糊。
在文件头设置绝对模糊位和绝对模糊SCN
让RMAN在线备份进程从数据文件读取每个块时。它们从块缓存的头部获取到SCN,和当前绝对模糊SCN对比,这个SCN将被在文件头结构初始化设置为0,如果块的SCN更大,那么将拷贝块的SCN来作为文件头的绝对SCN。
这样的话,到文件结束时,这个绝对模糊SCN在文件头结构中包含的是整个数据文件块中的最高的SCN。
如果绝对模糊SCN高于数据文件的检查点SCN,那么其将维持绝对模糊SCN并且设置绝对模糊位。否则将简单的清理绝对模糊SCN,因为文件不需要应用redo来保证一致性。
所有的事情都由RMAN在目标实例上在通道中完成。
清理绝对模糊SCN
在恢复时,检查点将在日志边界处和结束介质恢复标记处发生。
在这个情况下,如果绝对模糊位设置了,并且如果检查点SCN大于或等于绝对模糊SCN,那么其将清理绝对模糊SCN并且清理绝对模糊位。在数据文件头中的绝对模糊SCN将被设置为0
Comment