BBED SKIP ARCHIVE RECOVER

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:37

[i]1.1 [i]环境准备[size=10.0pt]SQL>select * from v$version;[size=10.0pt]BANNER[size=10.0pt]----------------------------------------------------------------[size=10.0pt]OracleDatabase 10g Enterprise Edition Release 10.2.0.5.0 - 64bi[size=10.0pt]PL/SQLRelease 10.2.0.5.0 - Production[size=10.0pt]CORE 10.2.0.5.0 Production[size=10.0pt]TNSfor Linux: Version 10.2.0.5.0 - Production[size=10.0pt]NLSRTLVersion 10.2.0.5.0 – Production[i][size=10.0pt]create tablespace willson datafile '/u01/oracle/oradata/orcl/willson1.dbf' size50m;[i][size=10.0pt]alter tablespace willson add datafile'/u01/oracle/oradata/orcl/willson2.dbf' size 50m;[i][size=10.0pt]alter tablespace willson add datafile'/u01/oracle/oradata/orcl/willson3.dbf' size 50m;[size=10.0pt]SQL> archive log list[size=10.0pt]Database log mode Archive Mode[size=10.0pt]Automatic archival Enabled[size=10.0pt]Archive destination /u01/oracle/archive[size=10.0pt]Oldest online log sequence 57[size=10.0pt]Next log sequence to archive 58[size=10.0pt]Current log sequence 58[size=10.0pt] [size=10.0pt]s[size=10.0pt]elect HXFIL File_num,substr(HXFNM,1,40) File_name, FHSCN SCN,FHSTA status ,FHRBA_SEQ Sequence from X$KCVFH;[size=10.0pt]FILE_NUMFILE_NAME SCN STATUS SEQUENCE[size=10.0pt]------------------------------------------------------- ---------------- --------------------[size=10.0pt] 1/u01/oracle/oradata/orcl/system01.dbf 948761 8196 57[size=10.0pt] 2/u01/oracle/oradata/orcl/undotbs01.dbf 948761 4 57[size=10.0pt] 3/u01/oracle/oradata/orcl/sysaux01.dbf 948761 4 57[size=10.0pt] 4/u01/oracle/oradata/orcl/users01.dbf 948761 4 57[size=10.0pt] 5/u01/oracle/oradata/orcl/willson1.dbf 949022 4 57[size=10.0pt] 6/u01/oracle/oradata/orcl/willson2.dbf 949052 4 57[size=10.0pt] 7/u01/oracle/oradata/orcl/willson3.dbf 949078 4 57[size=10.0pt] y file[size=10.0pt] FHCCC NUMBER Control fileCheckpoint Count at read before write[size=10.0pt] FHBHZ NUMBER 7.3 file size when begin hot backup[size=10.0pt] FHBCP_SCN VARCHAR2(16) SCN allocated for backup checkpoint[size=10.0pt] FHBCP_TIM VARCHAR2(20) TIMe when SCN allocated[size=10.0pt] FHBCP_THR NUMBER THRead whichallocated SCN[size=10.0pt]Backup CheckPoint RBA whereSCN was allocated:[size=10.0pt] FHBCP_RBA_SEQ NUMBER log seq #[size=10.0pt] FHBCP_RBA_BNO NUMBER block # in logfile[size=10.0pt] FHBCP_RBA_BOF NUMBER byte offset inblock[size=10.0pt] FHBCP_ETB RAW(8) EnabledThreads Bitvec[size=10.0pt] FHBHZ NUMBER 8.x file size when begin hot backup[size=10.0pt] FHXCD RAW(16) 8.x external cache id[size=10.0pt] FHTSN NUMBER 8.x tablespace number[size=10.0pt] FHTNM VARCHAR2(30) 8.x tablespace name[size=10.0pt] FHRFN NUMBER 8.x relative file number[size=10.0pt] FHAFS VARCHAR2(16) 8.x Absolute Fuzzy SCN[size=10.0pt] FHRFS VARCHAR2(16) 8.x media Recovery Fuzzy SCN[size=10.0pt] FHRFT VARCHAR2(20) 8.x media Recovery Fuzzy Timestamp[size=10.0pt] HXIFZ NUMBER 8.x is fuzzy flag[size=10.0pt] HXNRCV NUMBER 8.x need recovery flag[size=10.0pt] HXFNM VARCHAR2(513) 8.x datafile name[size=10.0pt] FHPOFB NUMBER 8.x previous version SDBAOFBITS (File #1 only)[size=10.0pt] FHPNFB NUMBER 8.x previous version SDBANFBITS (File #1 only)[size=10.0pt]SQL>create user willson identified by willson default tablespace willson;[size=10.0pt]Usercreated.[size=10.0pt]SQL>grant dba to willson;[size=10.0pt]Grantsucceeded.[size=10.0pt]我这里是使用willson 用户创建了一张test 表并且插入500条数据。[size=10.0pt]SQL>create table test (id number,name varchar2(50));[size=10.0pt]Tablecreated.[size=10.0pt]SQL>begin[size=10.0pt] for i in 1 .. 500 loop[size=10.0pt] insert into testvalues(i,'willson');[size=10.0pt] commit;[size=10.0pt] end loop;[size=10.0pt] end; 2 3 4 5 6 [size=10.0pt] 7 /[size=10.0pt]PL/SQLprocedure successfully completed.[size=10.0pt]SQL>[size=10.0pt]SQL>select count(*) from test;[size=10.0pt] COUNT(*)[size=10.0pt]----------[size=10.0pt] 500[size=10.0pt]
[size=10.0pt]做了几次logfile 切换。[size=10.0pt]SQL>alter system switch logfile;[size=10.0pt]Systemaltered.[size=10.0pt]SQL>/[size=10.0pt]Systemaltered.[size=10.0pt]SQL>/[size=10.0pt]Systemaltered.[size=10.0pt]SQL>/[size=10.0pt]Systemaltered.[size=10.0pt]SQL>/[size=10.0pt]Systemaltered.[size=10.0pt]SQL>/[size=10.0pt]Systemaltered.[size=10.0pt][oracle@db1archive]$ ls -l[size=10.0pt]total2420[size=10.0pt]-rw-r-----1 oracle oinstall 2041344 Feb 5 17:051_57_769085431.dbf[size=10.0pt]-rw-r-----1 oracle oinstall 1024 Feb 5 17:05 1_58_769085431.dbf[size=10.0pt]-rw-r-----1 oracle oinstall 4096 Feb 5 17:05 1_59_769085431.dbf[size=10.0pt]-rw-r-----1 oracle oinstall 4096 Feb 5 17:05 1_60_769085431.dbf[size=10.0pt]-rw-r-----1 oracle oinstall 1536 Feb 5 17:05 1_61_769085431.dbf[size=10.0pt]-rw-r-----1 oracle oinstall 1024 Feb 5 17:05 1_62_769085431.dbf[size=10.0pt]-rw-r-----1 oracle oinstall 384000 Feb 5 17:09 1_63_769085431.dbf[size=10.0pt]-rw-r-----1 oracle oinstall 1024 Feb 5 17:09 1_64_769085431.dbf[size=10.0pt]-rw-r-----1 oracle oinstall 2560 Feb 5 17:09 1_65_769085431.dbf[size=10.0pt]-rw-r-----1 oracle oinstall 1024 Feb 5 17:09 1_66_769085431.dbf[size=10.0pt]-rw-r-----1 oracle oinstall 1024 Feb 5 17:09 1_67_769085431.dbf[size=10.0pt]-rw-r-----1 oracle oinstall 1024 Feb 5 17:09 1_68_769085431.dbf [i]1.2 [i]BBED [i]安装[size=10.0pt][oracle@db1lib]$ cd /u01/oracle/product/10.2.0/db_1/rdbms/lib[i][size=10.0pt][oracle@db1 lib]$ make -fins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed[size=10.0pt]LinkingBBED utility (bbed)
[i]1.3 [i]测试过程[size=10.0pt]对[size=10.0pt] datafile 5[size=10.0pt]进行[size=10.0pt]offline[size=10.0pt]操作[size=10.0pt]SQL>alter database datafile 5 offline;[size=10.0pt]SQL>alter system switch logfile;[size=10.0pt] [size=10.0pt]多做几次redo switch[size=10.0pt]Systemaltered.[size=10.0pt]SQL>select HXFIL File_num,substr(HXFNM,1,40) File_name, FHSCN SCN, FHSTA status,FHRBA_SEQ Sequence from X$KCVFH;[size=10.0pt] FILE_NUM FILE_NAME SCN STATUS SEQUENCE[size=10.0pt]------------------------------------------------------- ---------------- ---------- [size=10.0pt] 1/u01/oracle/oradata/orcl/system01.dbf 950660 8196 71[size=10.0pt] 2/u01/oracle/oradata/orcl/undotbs01.dbf 950660 4 71[size=10.0pt] 3/u01/oracle/oradata/orcl/sysaux01.dbf 950660 4 71[size=10.0pt] 4/u01/oracle/oradata/orcl/users01.dbf 950660 4 71[size=10.0pt] 5 /u01/oracle/oradata/orcl/willson1.dbf 950658 4 70[size=10.0pt] 6/u01/oracle/oradata/orcl/willson2.dbf 950660 4 71[size=10.0pt] 7/u01/oracle/oradata/orcl/willson3.dbf 950660 4 71[size=10.0pt]SQL>archive log list[size=10.0pt]Databaselog mode Archive Mode[size=10.0pt]Automaticarchival Enabled[size=10.0pt]Archivedestination /u01/oracle/archive[size=10.0pt]Oldest online log sequence 71[size=10.0pt]Nextlog sequence to archive 73[size=10.0pt]Currentlog sequence 73[size=10.0pt]SQL>select file#,ONLINE_STATUS,ERROR,CHANGE# from V$RECOVER_FILE order by 1;[size=10.0pt] FILE# ONLINE_ ERROR CHANGE#[size=10.0pt]----------------- ----------------------------------------------------------------- [size=10.0pt] 5 OFFLINE 950658[size=10.0pt]SQL>select name, checkpoint_change# from v$datafile;[size=10.0pt]NAME CHECKPOINT_CHANGE#[size=10.0pt]---------------------------------------------------------------[size=10.0pt]/u01/oracle/oradata/orcl/system01.dbf 950660[size=10.0pt]/u01/oracle/oradata/orcl/undotbs01.dbf 950660[size=10.0pt]/u01/oracle/oradata/orcl/sysaux01.dbf 950660[size=10.0pt]/u01/oracle/oradata/orcl/users01.dbf 950660[size=10.0pt]/u01/oracle/oradata/orcl/willson1.dbf 950658[size=10.0pt]/u01/oracle/oradata/orcl/willson2.dbf 950660[size=10.0pt]/u01/oracle/oradata/orcl/willson3.dbf 950660[size=10.0pt]现在已经把datafile 5offline 了可以通过SCN 和SEQ观察。[size=10.0pt]下面我们通过BBED观察下正常的datafile 的情况[size=10.0pt][oracle@db1oracle]$ bbed parfile=bbed.txt [size=10.0pt]Password:[size=10.0pt]BBED:Release 2.0.0.0.0 - Limited Production on Sun Feb 5 17:21:22 2012[size=10.0pt]Copyright(c) 1982, 2007, Oracle. All rightsreserved.[size=10.0pt]*************!!! For Oracle Internal Use only !!! ***************[size=10.0pt]BBED>set file 6[size=10.0pt] FILE# 6[size=10.0pt]BBED>map /v[size=10.0pt] File: /u01/oracle/oradata/orcl/willson2.dbf(6)[size=10.0pt] Block: 1 Dba:0x01800001[size=10.0pt]------------------------------------------------------------[size=10.0pt] Data File Header[size=10.0pt] struct kcvfh, 676 bytes [size=10.0pt] @0 [size=10.0pt] struct kcvfhbfh, 20 bytes @0 [size=10.0pt] struct kcvfhhdr, 76 bytes @20 [size=10.0pt] ub4 kcvfhrdb @96 [size=10.0pt] struct kcvfhcrs, 8 bytes @100 [size=10.0pt] ub4 kcvfhcrt @108 [size=10.0pt] ub4 kcvfhrlc @112 [size=10.0pt] struct kcvfhrls, 8 bytes @116 [size=10.0pt] ub4 kcvfhbti @124 [size=10.0pt] struct kcvfhbsc, 8 bytes @128 [size=10.0pt] ub2 kcvfhbth @136 [size=10.0pt] ub2 kcvfhsta @138 [size=10.0pt] struct kcvfhckp, 36 bytes @484 [size=10.0pt] ub4 kcvfhcpc @140 [size=10.0pt] ub4 kcvfhrts @144 [size=10.0pt] ub4 kcvfhccc @148 [size=10.0pt] struct kcvfhbcp, 36 bytes @152 [size=10.0pt] ub4 kcvfhbhz @312 [size=10.0pt] s[size=10.0pt] [size=10.0pt]BBED> p kcvfh[size=10.0pt]structkcvfh, 676 bytes @0 [size=10.0pt] struct kcvfhbfh, 20 bytes @0 [size=10.0pt] ub1 type_kcbh @0 0x0b[size=10.0pt] ub1 frmt_kcbh @1 0xa2[size=10.0pt] ub1 spare1_kcbh @2 0x00[size=10.0pt] ub1 spare2_kcbh @3 0x00[size=10.0pt] ub4 rdba_kcbh @4 0x01800001[size=10.0pt] ub4 bas_kcbh @8 0x00000000[size=10.0pt] ub2 wrp_kcbh @12 0x0000[size=10.0pt] ub1 seq_kcbh @14 0x01[size=10.0pt] ub1 flg_kcbh @15 0x04 (KCBHFCKV)[size=10.0pt] ub2 chkval_kcbh @16 0xf4b7[size=10.0pt] ub2 spare3_kcbh @18 0x0000[size=10.0pt] struct kcvfhhdr, 76 bytes @20 [size=10.0pt] ub4 kccfhswv @20 0x00000000[size=10.0pt] ub4 kccfhcvn @24 0x0a200100[size=10.0pt] ub4 kccfhdbi @28 0x4d4c9b77[size=10.0pt] text kccfhdbn[0] @32 O[size=10.0pt] text kccfhdbn[1] @33 R[size=10.0pt] text kccfhdbn[2] @34 C[size=10.0pt] text kccfhdbn[3] @35 L[size=10.0pt] text kccfhdbn[4] @36 [size=10.0pt] text kccfhdbn[5] @37 [size=10.0pt] text kccfhdbn[6] @38 [size=10.0pt] text kccfhdbn[7] @39 [size=10.0pt] ub4 kccfhcsq @40 0x00000217[size=10.0pt] ub4 kccfhfsz @44 0x00001900[size=10.0pt] s_blkz kccfhbsz @48 0x00[size=10.0pt] ub2 kccfhfno @52 0x0006[size=10.0pt] ub2 kccfhtyp @54 0x0003[size=10.0pt] ub4 kccfhacid @56 0x00000000[size=10.0pt] ub4 kccfhcks @60 0x00000000[size=10.0pt] text kccfhtag[0] @64 [size=10.0pt] text kccfhtag[1] @65 [size=10.0pt] text kccfhtag[2] @66 [size=10.0pt] text kccfhtag[3] @67 [size=10.0pt] text kccfhtag[4] @68 [size=10.0pt] text kccfhtag[5] @69 [size=10.0pt] text kccfhtag[6] @70 [size=10.0pt] text kccfhtag[7] @71 [size=10.0pt] text kccfhtag[8] @72 [size=10.0pt] text kccfhtag[9] @73 [size=10.0pt] text kccfhtag[10] @74 [size=10.0pt] text kccfhtag[11] @75 [size=10.0pt] text kccfhtag[12] @76 [size=10.0pt] text kccfhtag[13] @77 [size=10.0pt] text kccfhtag[14] @78 [size=10.0pt] text kccfhtag[15] @79 [size=10.0pt] text kccfhtag[16] @80 [size=10.0pt] text kccfhtag[17] @81 [size=10.0pt] text kccfhtag[18] @82 [size=10.0pt] text kccfhtag[19] @83 [size=10.0pt] text kccfhtag[20] @84 [size=10.0pt] text kccfhtag[21] @85 [size=10.0pt] text kccfhtag[22] @86 [size=10.0pt] text kccfhtag[23] @87 [size=10.0pt] text kccfhtag[24] @88 [size=10.0pt] text kccfhtag[25] @89 [size=10.0pt] text kccfhtag[26] @90 [size=10.0pt] text kccfhtag[27] @91 [size=10.0pt] text kccfhtag[28] @92 [size=10.0pt] text kccfhtag[29] @93 [size=10.0pt] text kccfhtag[30] @94 [size=10.0pt] text kccfhtag[31] @95 [size=10.0pt] ub4 kcvfhrdb @96 0x00000000[size=10.0pt] struct kcvfhcrs, 8 bytes @100 [size=10.0pt] ub4 kscnbas @100 0x000e7b39[size=10.0pt] ub2 kscnwrp @104 0x0000[size=10.0pt] ub4 kcvfhcrt @108 0x2e296417[size=10.0pt] ub4 kcvfhrlc @112 0x2dd74ff7[size=10.0pt] struct kcvfhrls, 8 bytes @116 [size=10.0pt] ub4 kscnbas @116 0x00000001[size=10.0pt] ub2 kscnwrp @120 0x0000[size=10.0pt] ub4 kcvfhbti @124 0x00000000[size=10.0pt] struct kcvfhbsc, 8 bytes @128 [size=10.0pt] ub4 kscnbas @128 0x00000000[size=10.0pt] ub2 kscnwrp @132 0x0000[size=10.0pt] ub2 kcvfhbth @136 0x0000[size=10.0pt] ub2 kcvfhsta @138 0x0004 (KCVFHOFZ)[size=10.0pt] struct kcvfhckp, 36 bytes @484 [size=10.0pt] struct kcvcpscn, 8bytes @484 [size=10.0pt] ub4 kscnbas @484 0x000e81bb[size=10.0pt] ub2 kscnwrp @488 0x0000[size=10.0pt] ub4 kcvcptim @492 0x2e29673f[size=10.0pt] ub2 kcvcpthr @496 0x0001[size=10.0pt] union u, 12 bytes @500 [size=10.0pt] struct kcvcprba,12 bytes @500 [size=10.0pt] ub4 kcrbaseq @500 0x00000048[size=10.0pt] ub4 kcrbabno @504 0x00000002[size=10.0pt] ub2 kcrbabof @508 0x0010[size=10.0pt] ub1 kcvcpetb[0] @512 0x02[size=10.0pt] ub1 kcvcpetb[1] @513 0x00[size=10.0pt] ub1 kcvcpetb[2] @514 0x00[size=10.0pt] ub1 kcvcpetb[3] @515 0x00[size=10.0pt] ub1 kcvcpetb[4] @516 0x00[size=10.0pt] ub1 kcvcpetb[5] @517 0x00[size=10.0pt] ub1 kcvcpetb[6] @518 0x00[size=10.0pt] ub1 kcvcpetb[7] @519 0x00[size=10.0pt] ub4 kcvfhcpc @140 0x0000000e[size=10.0pt] ub4 kcvfhrts @144 0x00000000[size=10.0pt] ub4 kcvfhccc @148 0x0000000d[size=10.0pt] struct kcvfhbcp, 36 bytes @152 [size=10.0pt] struct kcvcpscn, 8 bytes @152 [size=10.0pt] ub4 kscnbas @152 0x00000000[size=10.0pt] ub2 kscnwrp @156 0x0000[size=10.0pt] ub4 kcvcptim @160 0x00000000[size=10.0pt] ub2 kcvcpthr @164 0x0000[size=10.0pt] union u, 12 bytes @168 [size=10.0pt] struct kcvcprba, 12 bytes @168 [size=10.0pt] ub4 kcrbaseq @168 0x00000000[size=10.0pt] ub4 kcrbabno @172 0x00000000[size=10.0pt] ub2 kcrbabof @176 0x0000[size=10.0pt] ub1 kcvcpetb[0] @180 0x00[size=10.0pt] ub1 kcvcpetb[1] @181 0x00[size=10.0pt] ub1 kcvcpetb[2] @182 0x00[size=10.0pt] ub1 kcvcpetb[3] @183 0x00[size=10.0pt] ub1 kcvcpetb[4] @184 0x00[size=10.0pt] ub1 kcvcpetb[5] @185 0x00[size=10.0pt] ub1 kcvcpetb[6] @186 0x00[size=10.0pt] ub1 kcvcpetb[7] @187 0x00[size=10.0pt] ub4 kcvfhbhz @312 0x00000000[size=10.0pt] struct kcvfhxcd, 16 bytes @316 [size=10.0pt] ub4 space_kcvmxcd[0] @316 0x00000000[size=10.0pt] ub4 space_kcvmxcd[1] @320 0x00000000[size=10.0pt] ub4 space_kcvmxcd[2] @324 0x00000000[size=10.0pt] ub4 space_kcvmxcd[3] @328 0x00000000[size=10.0pt] word kcvfhtsn @332 5[size=10.0pt] ub2 kcvfhtln @336 0x0007[size=10.0pt] text kcvfhtnm[0] @338 W[size=10.0pt] [size=10.0pt] struct kcvfhprs, 8 bytes @420 [size=10.0pt] ub4 kscnbas @420 0x00000000[size=10.0pt] ub2 kscnwrp @424 0x0000[size=10.0pt] struct kcvfhprfs, 8 bytes @428 [size=10.0pt] ub4 kscnbas @428 0x00000000[size=10.0pt] ub2 kscnwrp @432 0x0000[size=10.0pt] ub4 kcvfhtrt @444 0x00000000[size=10.0pt]BBED> p kcvfhckp[size=10.0pt]structkcvfhckp, 36 bytes @484 [size=10.0pt] struct kcvcpscn, 8bytes @484 [size=10.0pt] ub4 kscnbas @484 0x000e81bb[size=10.0pt] ub2 kscnwrp @488 0x0000[size=10.0pt] ub4 kcvcptim @492 0x2e29673f[size=10.0pt] ub2 kcvcpthr @496 0x0001[size=10.0pt] union u, 12 bytes @500 [size=10.0pt] struct kcvcprba, 12 bytes @500 [size=10.0pt] ub4kcrbaseq @500 0x00000048[size=10.0pt] ub4kcrbabno @504 0x00000002[size=10.0pt] ub2 kcrbabof @508 0x0010[size=10.0pt] ub1 kcvcpetb[0] @512 0x02[size=10.0pt] ub1 kcvcpetb[1] @513 0x00[size=10.0pt] ub1 kcvcpetb[2] @514 0x00[size=10.0pt] ub1 kcvcpetb[3] @515 0x00[size=10.0pt] ub1 kcvcpetb[4] @516 0x00[size=10.0pt] ub1 kcvcpetb[5] @517 0x00[size=10.0pt] ub1 kcvcpetb[6] @518 0x00[size=10.0pt] ub1 kcvcpetb[7] @519 0x00[size=10.0pt]红色的内容我们可以关联下X$KCVFH 内部表可以进行对比。[size=10.0pt]BBED>set file 5[size=10.0pt] FILE# 5[size=10.0pt]BBED> p kcvfhckp[size=10.0pt]structkcvfhckp, 36 bytes @484 [size=10.0pt] struct kcvcpscn, 8 bytes @484 [size=10.0pt] ub4 kscnbas @484 0x000e8182[size=10.0pt] ub2 kscnwrp @488 0x0000[size=10.0pt] ub4 kcvcptim @492 0x2e296738[size=10.0pt] ub2 kcvcpthr @496 0x0001[size=10.0pt] union u, 12 bytes @500 [size=10.0pt] struct kcvcprba, 12 bytes @500 [size=10.0pt] ub4 kcrbaseq @500 0x00000046[size=10.0pt] ub4 kcrbabno @504 0x00000002[size=10.0pt] ub2 kcrbabof @508 0x0010[size=10.0pt] ub1 kcvcpetb[0] @512 0x02[size=10.0pt] ub1 kcvcpetb[1] @513 0x00[size=10.0pt] ub1 kcvcpetb[2] @514 0x00BBED> set file 1[size=10.0pt] FILE# 1[size=10.0pt]BBED> p kcvfhckp[size=10.0pt]structkcvfhckp, 36 bytes @484 [size=10.0pt] struct kcvcpscn, 8 bytes @484 [size=10.0pt] ub4 kscnbas @484 0x000e81ea[size=10.0pt] ub2 kscnwrp @488 0x0000[size=10.0pt] ub4 kcvcptim @492 0x2e2967a6[size=10.0pt] ub2 kcvcpthr @496 0x0001[size=10.0pt] union u, 12 bytes @500 [size=10.0pt] struct kcvcprba, 12 bytes @500 [size=10.0pt] ub4 kcrbaseq @500 0x00000049[size=10.0pt] ub4 kcrbabno @504 0x00000002[size=10.0pt] ub2 kcrbabof @508 0x0010[size=10.0pt] ub1 kcvcpetb[0] @512 0x02[size=10.0pt] ub1 kcvcpetb[1] @513 0x00[size=10.0pt] ub1kcvcpetb[2] @514 0x00[size=10.0pt] ub1 kcvcpetb[3] @515 0x00[size=10.0pt] ub1 kcvcpetb[4] @516 0x00[size=10.0pt] ub1 kcvcpetb[5] @517 0x00[size=10.0pt] ub1 kcvcpetb[6] @518 0x00[size=10.0pt] ub1 kcvcpetb[7] @519 0x00[size=10.0pt]我们可以根据BBED看到的内而得出当前SCN与SEQ[size=10.0pt]SQL>select to_number('4[size=10.0pt]9[size=10.0pt]','xxxxx') from dual;[size=10.0pt]TO_NUMBER('48','XXXXX')[size=10.0pt]-----------------------[size=10.0pt] 7[size=10.0pt]3[size=10.0pt]SQL>select to_number('46','xxxxx') from dual;[size=10.0pt]TO_NUMBER('46','XXXXX')[size=10.0pt]-----------------------[size=10.0pt] 70[size=10.0pt]SQL> select to_char(71,'xxxxxx') from dual;[size=10.0pt]TO_CHAR[size=10.0pt]-------[size=10.0pt] 47[size=10.0pt]SQL>select to_number('e8182','xxxxx') from dual;[size=10.0pt]TO_NUMBER('E8182','XXXXX')[size=10.0pt]--------------------------[size=10.0pt] 950658[size=10.0pt]SQL>select to_number('e81ea','xxxxx') from dual;[size=10.0pt] [size=10.0pt]TO_NUMBER('E81EA','XXXXX')[size=10.0pt]--------------------------[size=10.0pt] 950762[size=10.0pt]SQL>select HXFIL File_num,substr(HXFNM,1,40) File_name, FHSCN SCN, FHSTA status,FHRBA_SEQ Sequence from X$KCVFH;[size=10.0pt] FILE_NUM FILE_NAME SCN STATUS SEQUENCE[size=10.0pt]------------------------------------------------------- ---------------- ---------- 1 /u01/oracle/oradata/orcl/system01.dbf 950762 8196 73[size=10.0pt] 2/u01/oracle/oradata/orcl/undotbs01.dbf 950762 4 73[size=10.0pt] 3/u01/oracle/oradata/orcl/sysaux01.dbf 950762 4 73[size=10.0pt] 4/u01/oracle/oradata/orcl/users01.dbf 950762 4 73[size=10.0pt] 5/u01/oracle/oradata/orcl/willson1.dbf 950658 4 70[size=10.0pt] 6/u01/oracle/oradata/orcl/willson2.dbf 950762 4 73[size=10.0pt] 7/u01/oracle/oradata/orcl/willson3.dbf 950762 4 73[size=10.0pt]接下来模拟下中间的一个归档缺少[size=10.0pt][oracle@db1oracle]$ cd archive/[size=10.0pt][oracle@db1archive]$ ls[size=10.0pt]1_57_769085431.dbf 1_60_769085431.dbf 1_63_769085431.dbf 1_66_769085431.dbf 1_69_769085431.dbf 1_72_769085431.dbf[size=10.0pt]1_58_769085431.dbf 1_61_769085431.dbf 1_64_769085431.dbf 1_67_769085431.dbf 1_70_769085431.dbf[size=10.0pt]1_59_769085431.dbf 1_62_769085431.dbf 1_65_769085431.dbf 1_68_769085431.dbf 1_71_769085431.dbf[size=10.0pt][oracle@db1 archive]$ mv 1_70_769085431.dbf ../[size=10.0pt][oracle@db1archive]$ ls[size=10.0pt]1_57_769085431.dbf 1_60_769085431.dbf 1_63_769085431.dbf 1_66_769085431.dbf 1_69_769085431.dbf[size=10.0pt]1_58_769085431.dbf 1_61_769085431.dbf 1_64_769085431.dbf 1_67_769085431.dbf 1_72_769085431.dbf[size=10.0pt]1_59_769085431.dbf 1_62_769085431.dbf 1_65_769085431.dbf 1_68_769085431.dbf[size=10.0pt]1_71_769085431.dbf[size=10.0pt]我已经把seq 70的归档给移走了,那么如果要online datafile 5的时候需要recover seq 70的归档是找不到的就会报错。[size=10.0pt]SQL>alter database datafile 5 online;[size=10.0pt]alterdatabase datafile 5 online[size=10.0pt]ERRORat line 1:[size=10.0pt]ORA-01113:file 5 needs media recovery if it was restored from backup, or END BACKUP if itwas not[size=10.0pt]ORA-01110: data file 5: '/u01/oracle/oradata/orcl/willson1.dbf'[size=10.0pt]SQL>recover datafile 5;[size=10.0pt]ORA-00279:change 950658 generated at 02/05/2012 17:15:36 needed for thread 1[size=10.0pt]ORA-00289: suggestion : /u01/oracle/archive/1_70_769085431.dbf[size=10.0pt]ORA-00280:change 950658 for thread 1 is in sequence #70[size=10.0pt]Specifylog: {=suggested | filename | AUTO | CANCEL}[size=10.0pt]auto[size=10.0pt]ORA-00308: cannot open archived log'/u01/oracle/archive/1_70_769085431.dbf'[size=10.0pt]ORA-27037:unable to obtain file status[size=10.0pt]Linux-x86_64Error: 2: No such file or directory[size=10.0pt]Additionalinformation: 3[size=10.0pt]ORA-00308: cannot open archived log'/u01/oracle/archive/1_70_769085431.dbf'[size=10.0pt]ORA-27037:unable to obtain file status[size=10.0pt]Linux-x86_64 Error: 2: No such file or directory[size=10.0pt]Additionalinformation: 3[size=10.0pt]现在缺失了[size=10.0pt]seq 70[size=10.0pt]的归档那么[size=10.0pt]datafile5 [size=10.0pt]就[size=10.0pt]online [size=10.0pt]出错了[size=10.0pt],[size=10.0pt]接下来我们可以使用一个内部表查看[size=10.0pt]View: X$KCCLH[size=10.0pt] [K]ernel [C]ache [C]ontrolfilemanagement [L]og[H]istory record[size=10.0pt] Column Type Description[size=10.0pt] -------- ---- -----------[size=10.0pt] ADDR RAW(4) address of this row/entry in theSGA[size=10.0pt] INDX NUMBER index number ofthis row in the fixed table array[size=10.0pt] INST_ID NUMBER 8.x oracle instance number[size=10.0pt] ENTRY NUMBER 7.3 actual entry number[size=10.0pt] LHRID NUMBER 8.x recid[size=10.0pt] LHTSM VARCHAR2(20) 8.x TimeStaMp: interpretation of stm[size=10.0pt] LHSTM NUMBER 8.x STaMp used with recid to uniquely identifyrecord[size=10.0pt] LHTHP NUMBER parent THreadRecord's pointer (RedoThread rec#)[size=10.0pt] LHTHR NUMBER 7.3 Thread from which the entry came from[size=10.0pt] LHTNP NUMBER 8.x Thread's next oldest seq# log Hist Ptr(LogHist recid)[size=10.0pt] LHSEQ NUMBER SEQuence number within the threadof this log[size=10.0pt] LHLOS VARCHAR2(16) LOw Scn of the created log[size=10.0pt] LHLOT VARCHAR2(20) LOw scntimestamp[size=10.0pt] LHNXS VARCHAR2(16) NeXt Scn of thecreated log[size=10.0pt] LHNAM VARCHAR2(257) 7.3 name it wouldbe archived under[size=10.0pt] LHNAM VARCHAR2(513) 8.x name it wouldbe created under[size=10.0pt]SQL>select LHSEQ,LHNAM,LHRLS,LHLOS fromx$kcclh; [size=10.0pt] LHSEQ LHNAM LHRLS LHLOS[size=10.0pt]------------------------------------------------------- ---------------- [size=10.0pt] 1/u01/oracle/archive/1_1_769085431.dbf 1 1[size=10.0pt] 2/u01/oracle/archive/1_2_769085431.dbf 1 32367[size=10.0pt] 3/u01/oracle/archive/1_3_769085431.dbf 1 62562[size=10.0pt] 4/u01/oracle/archive/1_4_769085431.dbf 1 75247[size=10.0pt] 5/u01/oracle/archive/1_5_769085431.dbf 1 95850[size=10.0pt] 6/u01/oracle/archive/1_6_769085431.dbf 1 109572[size=10.0pt] 7/u01/oracle/archive/1_7_769085431.dbf 1 122870[size=10.0pt] 8/u01/oracle/archive/1_8_769085431.dbf 1 138381[size=10.0pt] 9/u01/oracle/archive/1_9_769085431.dbf 1 156412[size=10.0pt] 10 /u01/oracle/archive/1_10_769085431.dbf 1 171326[size=10.0pt] 11 /u01/oracle/archive/1_11_769085431.dbf 1 201821[size=10.0pt] 12 /u01/oracle/archive/1_12_769085431.dbf 1 235109[size=10.0pt] 13 /u01/oracle/archive/1_13_769085431.dbf 1 273124[size=10.0pt] 14 /u01/oracle/archive/1_14_769085431.dbf 1 306086[size=10.0pt] 15 /u01/oracle/archive/1_15_769085431.dbf 1 318844[size=10.0pt] 16 /u01/oracle/archive/1_16_769085431.dbf 1 337334[size=10.0pt] 17 /u01/oracle/archive/1_17_769085431.dbf 1 355541[size=10.0pt] 18 /u01/oracle/archive/1_18_769085431.dbf 1 375155[size=10.0pt] 19 /u01/oracle/archive/1_19_769085431.dbf 1 389924[size=10.0pt] 20 /u01/oracle/archive/1_20_769085431.dbf 1 406456[size=10.0pt] 21 /u01/oracle/archive/1_21_769085431.dbf 1 424001[size=10.0pt] 22 /u01/oracle/archive/1_22_769085431.dbf 1 435578[size=10.0pt] 23 /u01/oracle/archive/1_23_769085431.dbf 1 442367[size=10.0pt] 24 /u01/oracle/archive/1_24_769085431.dbf 1 460734[size=10.0pt] 25 /u01/oracle/archive/1_25_769085431.dbf 1 470512[size=10.0pt] 26 /u01/oracle/archive/1_26_769085431.dbf 1 510416[size=10.0pt] 27 /u01/oracle/archive/1_27_769085431.dbf 1 531165[size=10.0pt] 28 /u01/oracle/archive/1_28_769085431.dbf 1 561652[size=10.0pt] 29 /u01/oracle/archive/1_29_769085431.dbf 1 582869[size=10.0pt] 30 /u01/oracle/archive/1_30_769085431.dbf 1 595698[size=10.0pt] 31 /u01/oracle/archive/1_31_769085431.dbf 1 607330[size=10.0pt] 32 /u01/oracle/archive/1_32_769085431.dbf 1 629694[size=10.0pt] 33 /u01/oracle/archive/1_33_769085431.dbf 1 642399[size=10.0pt] 34 /u01/oracle/archive/1_34_769085431.dbf 1 650869[size=10.0pt] 35 /u01/oracle/archive/1_35_769085431.dbf 1 665977[size=10.0pt] 36 /u01/oracle/archive/1_36_769085431.dbf 1 676225[size=10.0pt] 37 /u01/oracle/archive/1_37_769085431.dbf 1 685480[size=10.0pt] 38 /u01/oracle/archive/1_38_769085431.dbf 1 693848[size=10.0pt] 39 /u01/oracle/archive/1_39_769085431.dbf 1 702446[size=10.0pt] 40 /u01/oracle/archive/1_40_769085431.dbf 1 708850[size=10.0pt] 41 /u01/oracle/archive/1_41_769085431.dbf 1 713501[size=10.0pt] 42 /u01/oracle/archive/1_42_769085431.dbf 1 732978[size=10.0pt] 43 /u01/oracle/archive/1_43_769085431.dbf 1 747538[size=10.0pt] 44 /u01/oracle/archive/1_44_769085431.dbf 1 759158[size=10.0pt] 45 /u01/oracle/archive/1_45_769085431.dbf 1 768452[size=10.0pt] 46 /u01/oracle/archive/1_46_769085431.dbf 1 777683[size=10.0pt] 47 /u01/oracle/archive/1_47_769085431.dbf 1 792122[size=10.0pt] 48 /u01/oracle/archive/1_48_769085431.dbf 1 806981[size=10.0pt] 49 /u01/oracle/archive/1_49_769085431.dbf 1 822640[size=10.0pt] 50 /u01/oracle/archive/1_50_769085431.dbf 1 828284[size=10.0pt] 51 /u01/oracle/archive/1_51_769085431.dbf 1 838600[size=10.0pt] 52 /u01/oracle/archive/1_52_769085431.dbf 1 842607[size=10.0pt] 53 /u01/oracle/archive/1_53_769085431.dbf 1 847923[size=10.0pt] 54 /u01/oracle/archive/1_54_769085431.dbf 1 859699[size=10.0pt] 55 /u01/oracle/archive/1_55_769085431.dbf 1 874273[size=10.0pt] 56 /u01/oracle/archive/1_56_769085431.dbf 1 897933[size=10.0pt] 57 /u01/oracle/archive/1_57_769085431.dbf 1 947905[size=10.0pt] 58 /u01/oracle/archive/1_58_769085431.dbf 1 949225[size=10.0pt] 59 /u01/oracle/archive/1_59_769085431.dbf 1 949227[size=10.0pt] 60 /u01/oracle/archive/1_60_769085431.dbf 1 949230[size=10.0pt] 61 /u01/oracle/archive/1_61_769085431.dbf 1 949235[size=10.0pt] 62 /u01/oracle/archive/1_62_769085431.dbf 1 949238[size=10.0pt] 63 /u01/oracle/archive/1_63_769085431.dbf 1 949240[size=10.0pt] 64 /u01/oracle/archive/1_64_769085431.dbf 1 950081[size=10.0pt] 65 /u01/oracle/archive/1_65_769085431.dbf 1 950083[size=10.0pt] 66 /u01/oracle/archive/1_66_769085431.dbf 1 950087[size=10.0pt] 67 /u01/oracle/archive/1_67_769085431.dbf 1 950089[size=10.0pt] 68 /u01/oracle/archive/1_68_769085431.dbf 1 950091[size=10.0pt] 69 /u01/oracle/archive/1_69_769085431.dbf 1 950093[size=10.0pt] 70 /u01/oracle/archive/1_70_769085431.dbf 1 950658[size=10.0pt] 71/u01/oracle/archive/1_71_769085431.dbf 1 950660[size=10.0pt] 72 /u01/oracle/archive/1_72_769085431.dbf 1 950715[size=10.0pt] 73 /u01/oracle/archive/1_73_769085431.dbf 1 950762[size=10.0pt]我们可以看到[size=10.0pt] seq 70[size=10.0pt]归档创建时的[size=10.0pt]SCN,[size=10.0pt]那么我们需要跳过[size=10.0pt]SEQ 70[size=10.0pt]归档的话[size=10.0pt],[size=10.0pt]下个归档[size=10.0pt]71[size=10.0pt]是存在的那么我们需要更改更[size=10.0pt]seq 71[size=10.0pt]的[size=10.0pt]SCN [size=10.0pt]SQL>select to_char(950660,'xxxxxx') from dual;[size=10.0pt]TO_CHAR[size=10.0pt]-------[size=10.0pt] e8184接下来我们需要更改datafile 5 的scn 与seq[size=10.0pt]BBED>set file 5[size=10.0pt] FILE# 5[size=10.0pt]BBED>p kcvfhckp[size=10.0pt]structkcvfhckp, 36 bytes @484 [size=10.0pt] struct kcvcpscn, 8 bytes @484 [size=10.0pt] ub4 kscnbas @484 0x000e8182[size=10.0pt] ub2 kscnwrp @488 0x0000[size=10.0pt] ub4 kcvcptim @492 0x2e296738[size=10.0pt] ub2 kcvcpthr @496 0x0001[size=10.0pt] union u, 12 bytes @500 [size=10.0pt] struct kcvcprba, 12 bytes @500 [size=10.0pt] ub4 kcrbaseq @500 0x00000046[size=10.0pt] ub4 kcrbabno @504 0x00000002[size=10.0pt] ub2 kcrbabof @508 0x0010[size=10.0pt] ub1 kcvcpetb[0] @512 0x02[size=10.0pt] ub1 kcvcpetb[1] @513 0x00[size=10.0pt] ub1 kcvcpetb[2] @514 0x00[size=10.0pt] ub1 kcvcpetb[3] @515 0x00[size=10.0pt] ub1 kcvcpetb[4] @516 0x00[size=10.0pt] ub1 kcvcpetb[5] @517 0x00[size=10.0pt] ub1 kcvcpetb[6] @518 0x00[size=10.0pt] ub1 kcvcpetb[7] @519 0x00[size=10.0pt] [size=10.0pt]BBED>d /v offset 484 count 16[size=10.0pt] File: /u01/oracle/oradata/orcl/willson1.dbf(5)[size=10.0pt] Block: 1 Offsets: 484 to 499 Dba:0x01400001[size=10.0pt]-------------------------------------------------------[size=10.0pt] 82810e00 0000ef703867292e 01008e00 l ......?8g).....[size=10.0pt] <16 bytes per line>[size=10.0pt]BBED> d /v offset 500 count 16BBED> [size=10.0pt] File:/u01/oracle/oradata/orcl/willson1.dbf (5)[size=10.0pt] Block: 1 Offsets: 500 to 515 Dba:0x01400001[size=10.0pt]-------------------------------------------------------[size=10.0pt] [size=10.0pt]46000000 [size=10.0pt]0200000010000000 02000000 l F...............[size=10.0pt] <16 bytes per line>[size=10.0pt] 可以看到现在bbed d /v 内容跟实际的正好相反,这是因为os 大小字节的关系[size=10.0pt]SQL>select d.platform_name,endian_format[size=10.0pt]fromv$transportable_platform tp,v$database d[size=10.0pt]wheretp.platform_name=d.platform_name; 2 3 [size=10.0pt]PLATFORM_NAME ENDIAN_FORMAT[size=10.0pt]-----------------------------------------------------------------------------------Linux x86 64-bit Little[size=10.0pt]更改[size=10.0pt]datafile 5scn [size=10.0pt]为[size=10.0pt]e8184[size=10.0pt] seq [size=10.0pt]为47[size=10.0pt]BBED> modify /x 47 offset 500[size=10.0pt] File: /u01/oracle/oradata/orcl/willson1.dbf(5)[size=10.0pt] Block: 1 Offsets: 500 to 515 Dba:0x01400001[size=10.0pt]------------------------------------------------------------------------[size=10.0pt] [size=10.0pt]47000000 [size=10.0pt]0200000010000000 02000000 [size=10.0pt] <32 bytes per line>[size=10.0pt]BBED> modify /x e8184 offset 484[size=10.0pt] File:/u01/oracle/oradata/orcl/willson1.dbf (5)[size=10.0pt] Block: 1 Offsets: 484 to 499 Dba:0x01400001[size=10.0pt]------------------------------------------------------------------------[size=10.0pt] [size=10.0pt]0e818400 [size=10.0pt]0000ef703867292e 01008e00 [size=10.0pt] <32 bytes per line>[size=10.0pt]BBED> sum apply[size=10.0pt]Check value for File 5, Block 1:[size=10.0pt]current = 0xb640, required = 0xb640好了,现在datafile 5file head 中scn 与seq 已经把seq 70的归档给跳过去了,我们试试online datafile 5.[size=10.0pt]SQL> recover datafile 5;[size=10.0pt]Media recovery complete.[size=10.0pt]SQL> alter database datafile 5 online;[size=10.0pt]Database altered.[size=10.0pt]SQL> select file#,name,status,ENABLED from v$datafile;[size=10.0pt] FILE# NAME STATUS ENABLED[size=10.0pt]---------- --------------------------------------------- -----------------[size=10.0pt] 1 /u01/oracle/oradata/orcl/system01.dbf SYSTEM READ WRITE[size=10.0pt] 2 /u01/oracle/oradata/orcl/undotbs01.dbf ONLINE READ WRITE[size=10.0pt] 3 /u01/oracle/oradata/orcl/sysaux01.dbf ONLINE READ WRITE[size=10.0pt] 4 /u01/oracle/oradata/orcl/users01.dbf ONLINE READ WRITE[size=10.0pt] [size=10.0pt] 5 /u01/oracle/oradata/orcl/willson1.dbf ONLINE READ WRITE[size=10.0pt] 6 /u01/oracle/oradata/orcl/willson2.dbf ONLINE READ WRITE[size=10.0pt] 7 /u01/oracle/oradata/orcl/willson3.dbf ONLINE READ WRITE[size=10.0pt]SQL> conn willson/willson[size=10.0pt]Connected.[size=10.0pt]SQL> select count(*) from test;[size=10.0pt] [size=10.0pt] COUNT(*)[size=10.0pt]----------[size=10.0pt] 500[size=10.0pt]SQL> shutdown immediate[size=10.0pt]Database closed.[size=10.0pt]Database dismounted.[size=10.0pt]ORACLE instance shut down.[size=10.0pt]SQL> startup[size=10.0pt]ORACLE instance started.[size=10.0pt]Total System Global Area 339738624 bytes[size=10.0pt]Fixed Size 2096120 bytes[size=10.0pt]Variable Size 201327624 bytes[size=10.0pt]Database Buffers 130023424 bytes[size=10.0pt]Redo Buffers 6291456 bytes[size=10.0pt]Database mounted.[size=10.0pt]Database opened.[size=10.0pt]SQL> select HXFIL File_num,substr(HXFNM,1,40) File_name, FHSCNSCN, FHSTA status ,FHRBA_SEQ Sequence from X$KCVFH;[size=10.0pt] FILE_NUM FILE_NAME SCN STATUS SEQUENCE[size=10.0pt]---------- ------------------------------------------------------------- ---------- [size=10.0pt] 1 /u01/oracle/oradata/orcl/system01.dbf 8683791 8196 75[size=10.0pt] 2 /u01/oracle/oradata/orcl/undotbs01.dbf 8683791 4 75[size=10.0pt] 3 /u01/oracle/oradata/orcl/sysaux01.dbf 8683791 4 75[size=10.0pt] 4 /u01/oracle/oradata/orcl/users01.dbf 8683791 4 75[size=10.0pt] [size=10.0pt] 5 /u01/oracle/oradata/orcl/willson1.dbf 8683791 4 75[size=10.0pt] 6 /u01/oracle/oradata/orcl/willson2.dbf 8683791 4 75[size=10.0pt] 7 /u01/oracle/oradata/orcl/willson3.dbf 8683791 4 75可以看到datafile 5可以正常online了,并且数据也没有丢失。当然使用这种方法某些情况下也是有问题。[size=10.0pt]

本文标签:
本文标题:BBED SKIP ARCHIVE RECOVER
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】