联系:手机(17813235971) QQ(107644445)
标题:file 1 block 128 corrupted/坏块恢复—system rollback坏块修复
作者:惜分飞©版权所有[未经本人同意,请不得以任何形式转载,否则有进一步追究法律责任的权利.]
有个数据库file 1 block 128 坏块导致数据库无法启动报错如下
该数据库版本是11.2.0.1,根据我们的经验该block是system rollback 的segment header,以下为我在正常哭查询结果
SQL> select file_id,block_id,blocks from dba_extents where segment_name='SYSTEM'; FILE_ID BLOCK_ID BLOCKS ---------- ---------- ---------- 1 128 8 1 136 8 1 528 8 1 536 8 1 544 8 1 552 8 6 rows selected.
dump file 1 block 128 结果
Dump all the blocks in range: buffer tsn: 0 rdba: 0x00400080 (1/128) scn: 0x0000.00000000 seq: 0xff flg: 0x04 tail: 0x00000eff frmt: 0x02 chkval: 0x1387 type: 0x0e=KTU UNDO HEADER W/UNLIMITED EXTENTS Hex dump of block: st=0, typ_found=1
这里可以看到block scn为0×0000.00000000,而且数据块已经被标记为坏块
dbv检查坏块结果
从这里可以看出来主要错误是由于Controlscn: 0×0004.119fe191 greater than blockscn: 0×0000.00000000,拷贝system文件到本地,使用bbed修改
bbed修复坏块
H:\temp\SYSTEM01>bbed password=blockedit filename=system01.dbf blocksize=8192 BBED: Release 2.0.0.0.0 - Limited Production on Thu Mar 17 00:23:49 2016 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. ************* !!! For Oracle Internal Use only !!! *************** BBED> show all FILE# 0 BLOCK# 1 OFFSET 0 DBA 0x00000000 (0 0,1) FILENAME system01.dbf BIFILE bifile.bbd LISTFILE BLOCKSIZE 8192 MODE Browse EDIT Unrecoverable IBASE Dec OBASE Dec WIDTH 80 COUNT 512 LOGFILE log.bbd SPOOL No BBED> set block 129 BLOCK# 129 BBED> map File: system01.dbf (0) Block: 129 Dba:0x00000000 ------------------------------------------------------------ Unlimited Undo Segment Header struct kcbh, 20 bytes @0 struct ktech, 72 bytes @20 struct ktemh, 16 bytes @92 struct ktetb[6], 48 bytes @108 struct ktuxc, 104 bytes @4148 struct ktuxe[204], 8160 bytes @4252 ub4 tailchk @8188 BBED> p kcbh struct kcbh, 20 bytes @0 ub1 type_kcbh @0 0x0e ub1 frmt_kcbh @1 0xa2 ub1 spare1_kcbh @2 0x00 ub1 spare2_kcbh @3 0x00 ub4 rdba_kcbh @4 0x00400080 ub4 bas_kcbh @8 0x00000000 ub2 wrp_kcbh @12 0x0000 ub1 seq_kcbh @14 0xff ub1 flg_kcbh @15 0x04 (KCBHFCKV) ub2 chkval_kcbh @16 0x1387 ub2 spare3_kcbh @18 0x0000 BBED> set mode edit MODE Edit BBED> d offset 8188 File: system01.dbf (0) Block: 129 Offsets: 8188 to 8191 Dba:0x00000000 ------------------------------------------------------------------------ ff0e0000 <32 bytes per line> BBED> m /x 01 offset 8188 File: system01.dbf (0) Block: 129 Offsets: 8188 to 8191 Dba:0x00000000 ------------------------------------------------------------------------ 010e0000 <32 bytes per line> BBED> verify DBVERIFY - Verification starting FILE = system01.dbf BLOCK = 128 DBVERIFY - Verification complete Total Blocks Examined : 1 Total Blocks Processed (Data) : 0 Total Blocks Failing (Data) : 0 Total Blocks Processed (Index): 0 Total Blocks Failing (Index): 0 Total Blocks Empty : 0 Total Blocks Marked Corrupt : 0 Total Blocks Influx : 0 BBED> sum apply Check value for File 0, Block 129: current = 0x1387, required = 0x1387 BBED> verify DBVERIFY - Verification starting FILE = system01.dbf BLOCK = 128 DBVERIFY - Verification complete Total Blocks Examined : 1 Total Blocks Processed (Data) : 0 Total Blocks Failing (Data) : 0 Total Blocks Processed (Index): 0 Total Blocks Failing (Index): 0 Total Blocks Empty : 0 Total Blocks Marked Corrupt : 0 Total Blocks Influx : 0 BBED> exit H:\temp\SYSTEM01>dbv file=SYSTEM01.DBF DBVERIFY: Release 12.1.0.2.0 - Production on 星期四 3月 17 00:26:26 2016 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. DBVERIFY - 开始验证: FILE = H:\TEMP\SYSTEM01\SYSTEM01.DBF Controlscn: 0x0004.119fe191 greater than blockscn: 0x0000.00000000 页 128 失败, 校验代码为 14509 页 128 失败, 校验代码为 14509 DBVERIFY - 验证完成 检查的页总数: 209920 处理的页总数 (数据): 132380 失败的页总数 (数据): 0 处理的页总数 (索引): 57168 失败的页总数 (索引): 0 处理的页总数 (其他): 3112 处理的总页数 (段) : 1 失败的总页数 (段) : 1 空的页总数: 17260 标记为损坏的总页数: 1 流入的页总数: 0 加密的总页数 : 0 最高块 SCN : 188826853 (5.188826853) H:\temp\SYSTEM01>bbed password=blockedit filename=system01.dbf BBED: Release 2.0.0.0.0 - Limited Production on Thu Mar 17 00:26:59 2016 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. ************* !!! For Oracle Internal Use only !!! *************** BBED> set blocksize 8192 BLOCKSIZE 8192 BBED> set block 129 BLOCK# 129 BBED> verify DBVERIFY - Verification starting FILE = system01.dbf BLOCK = 128 DBVERIFY - Verification complete Total Blocks Examined : 1 Total Blocks Processed (Data) : 0 Total Blocks Failing (Data) : 0 Total Blocks Processed (Index): 0 Total Blocks Failing (Index): 0 Total Blocks Empty : 0 Total Blocks Marked Corrupt : 0 Total Blocks Influx : 0 BBED> map File: system01.dbf (0) Block: 129 Dba:0x00000000 ------------------------------------------------------------ Unlimited Undo Segment Header struct kcbh, 20 bytes @0 struct ktech, 72 bytes @20 struct ktemh, 16 bytes @92 struct ktetb[6], 48 bytes @108 struct ktuxc, 104 bytes @4148 struct ktuxe[204], 8160 bytes @4252 ub4 tailchk @8188 BBED> p kcbh struct kcbh, 20 bytes @0 ub1 type_kcbh @0 0x0e ub1 frmt_kcbh @1 0xa2 ub1 spare1_kcbh @2 0x00 ub1 spare2_kcbh @3 0x00 ub4 rdba_kcbh @4 0x00400080 ub4 bas_kcbh @8 0x00000000 ub2 wrp_kcbh @12 0x0000 ub1 seq_kcbh @14 0x01 ub1 flg_kcbh @15 0x04 (KCBHFCKV) ub2 chkval_kcbh @16 0x1387 ub2 spare3_kcbh @18 0x0000 BBED> set mode edit MODE Edit BBED> m /x 0400 offset 12 File: system01.dbf (0) Block: 129 Offsets: 12 to 523 Dba:0x00000000 ------------------------------------------------------------------------ 04000104 87130000 00000000 00000000 00000000 00000000 06000000 2f000000 20100000 05000000 05000000 08000000 2d024000 00000000 05000000 00000000 00000000 00000000 00000000 00000000 06000000 00000000 00000000 00000040 81004000 07000000 88004000 08000000 10024000 08000000 18024000 08000000 20024000 08000000 28024000 08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <32 bytes per line> BBED> p kcbh struct kcbh, 20 bytes @0 ub1 type_kcbh @0 0x0e ub1 frmt_kcbh @1 0xa2 ub1 spare1_kcbh @2 0x00 ub1 spare2_kcbh @3 0x00 ub4 rdba_kcbh @4 0x00400080 ub4 bas_kcbh @8 0x00000000 ub2 wrp_kcbh @12 0x0004 ub1 seq_kcbh @14 0x01 ub1 flg_kcbh @15 0x04 (KCBHFCKV) ub2 chkval_kcbh @16 0x1387 ub2 spare3_kcbh @18 0x0000 BBED> m /x 625a60d0 offset 8 File: system01.dbf (0) Block: 129 Offsets: 8 to 519 Dba:0x00000000 ------------------------------------------------------------------------ 625a60d0 10000104 87130000 00000000 00000000 00000000 00000000 06000000 2f000000 20100000 05000000 05000000 08000000 2d024000 00000000 05000000 00000000 00000000 00000000 00000000 00000000 06000000 00000000 00000000 00000040 81004000 07000000 88004000 08000000 10024000 08000000 18024000 08000000 20024000 08000000 28024000 08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <32 bytes per line> BBED> p kcbh struct kcbh, 20 bytes @0 ub1 type_kcbh @0 0x0e ub1 frmt_kcbh @1 0xa2 ub1 spare1_kcbh @2 0x00 ub1 spare2_kcbh @3 0x00 ub4 rdba_kcbh @4 0x00400080 ub4 bas_kcbh @8 0xd0605a62 ub2 wrp_kcbh @12 0x0010 ub1 seq_kcbh @14 0x01 ub1 flg_kcbh @15 0x04 (KCBHFCKV) ub2 chkval_kcbh @16 0x1387 ub2 spare3_kcbh @18 0x0000 BBED> d offset 8188 File: system01.dbf (0) Block: 129 Offsets: 8188 to 8191 Dba:0x00000000 ------------------------------------------------------------------------ 010e0000 <32 bytes per line> BBED> m /x 010e625a File: system01.dbf (0) Block: 129 Offsets: 8188 to 8191 Dba:0x00000000 ------------------------------------------------------------------------ 010e625a <32 bytes per line> BBED> verify DBVERIFY - Verification starting FILE = system01.dbf BLOCK = 128 Block 128 is corrupt *** Corrupt block relative dba: 0x00400080 (file 0, block 128) Bad check value found during verification Data in bad block - type: 14 format: 2 rdba: 0x00400080 last change scn: 0x0010.34605a62 seq: 0x1 flg: 0x04 consistency value in tail: 0x5a620e01 check value in block header: 0x1387, computed block checksum: 0x3470 spare1: 0x0, spare2: 0x0, spare3: 0x0 *** DBVERIFY - Verification complete Total Blocks Examined : 1 Total Blocks Processed (Data) : 0 Total Blocks Failing (Data) : 0 Total Blocks Processed (Index): 0 Total Blocks Failing (Index): 0 Total Blocks Empty : 0 Total Blocks Marked Corrupt : 1 Total Blocks Influx : 0 BBED> sum apply Check value for File 0, Block 129: current = 0x27f7, required = 0x27f7 BBED> verify DBVERIFY - Verification starting FILE = system01.dbf BLOCK = 128 DBVERIFY - Verification complete Total Blocks Examined : 1 Total Blocks Processed (Data) : 0 Total Blocks Failing (Data) : 0 Total Blocks Processed (Index): 0 Total Blocks Failing (Index): 0 Total Blocks Empty : 0 Total Blocks Marked Corrupt : 0 Total Blocks Influx : 0 BBED> exit H:\temp\SYSTEM01>dbv file=SYSTEM01.DBF DBVERIFY: Release 12.1.0.2.0 - Production on 星期四 3月 17 00:40:38 2016 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. DBVERIFY - 开始验证: FILE = H:\TEMP\SYSTEM01\SYSTEM01.DBF DBVERIFY - 验证完成 检查的页总数: 209920 处理的页总数 (数据): 132380 失败的页总数 (数据): 0 处理的页总数 (索引): 57168 失败的页总数 (索引): 0 处理的页总数 (其他): 3112 处理的总页数 (段) : 1 失败的总页数 (段) : 0 空的页总数: 17260 标记为损坏的总页数: 0 流入的页总数: 0 加密的总页数 : 0 最高块 SCN : 188826853 (5.188826853)
这里发现当我们bbed验证非坏块之时,使用dbv检测依旧报坏块,可以看出来dbv的验证比bbed更加严格