二十一、使用BBED如何修复ORA-01578块错误
这两天在学习bbed的工具使用,看了eagle,崔华几位大师bbed恢复坏块方面的文章,也没有搞懂是如何来恢复的。
只好在论坛里发帖,请各位路过的高手指点迷经……..

下面列出我的实验步骤:
1.创建test2表空间,插入t1数据。
SQL> create tablespace test2 datafile ‘/u02/oradata/kmed11/test201.dbf’ size 10m;
Tablespace created.
SQL> alter user test2 default tablespace test2;
User altered.
SQL> select segment_name,segment_type,file_id,block_id from dba_extents where segment_name=’T1′ and owner=’TEST2′;
SEGMENT_NAME SEGMENT_TYPE FILE_ID BLOCK_ID
——————– —————— ———- ———-
T1 TABLE 8 128
T1 TABLE 8 136
T1 TABLE 8 144

SQL> select count(*) from test2.t1;
COUNT(*)
———-
523

2.打开bbed工具,先查询出修改前的块信息。
[oracle@kmed ~]$ bbed parfile=bbed.par
Password:
BBED: Release 2.0.0.0.0 – Limited Production on Mon Dec 13 12:33:29 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> set file 8
FILE# 8
BBED> set block 136
BLOCK# 136
BBED> map /v
File: /u02/oradata/kmed11/test201.dbf (8)
Block: 136 Dba:0×02000088
————————————————————
KTB Data Block (Table/Cluster)
struct kcbh, 20 bytes @0
ub1 type_kcbh @0
ub1 frmt_kcbh @1
ub1 spare1_kcbh @2
ub1 spare2_kcbh @3
ub4 rdba_kcbh @4
ub4 bas_kcbh @8
ub2 wrp_kcbh @12
ub1 seq_kcbh @14
ub1 flg_kcbh @15
ub2 chkval_kcbh @16
ub2 spare3_kcbh @18
struct ktbbh, 96 bytes @20
ub1 ktbbhtyp @20
union ktbbhsid, 4 bytes @24
struct ktbbhcsc, 8 bytes @28
sb2 ktbbhict @36
ub1 ktbbhflg @38
ub1 ktbbhfsl @39
ub4 ktbbhfnx @40
struct ktbbhitl[3], 72 bytes @44
struct kdbh, 14 bytes @124
ub1 kdbhflag @124
sb1 kdbhntab @125
sb2 kdbhnrow @126
sb2 kdbhfrre @128
sb2 kdbhfsbo @130
sb2 kdbhfseo @132
sb2 kdbhavsp @134
sb2 kdbhtosp @136
struct kdbt[1], 4 bytes @138
sb2 kdbtoffs @138
sb2 kdbtnrow @140
sb2 kdbr[29] @142
ub1 freespace[849] @200
ub1 rowdata[7139] @1049
ub4 tailchk @8188

BBED> p kcbh
struct kcbh, 20 bytes @0
ub1 type_kcbh @0 0×06
ub1 frmt_kcbh @1 0xa2
ub1 spare1_kcbh @2 0×00
ub1 spare2_kcbh @3 0×00
ub4 rdba_kcbh @4 0×02000088
ub4 bas_kcbh @8 0×00131872
ub2 wrp_kcbh @12 0×0000
ub1 seq_kcbh @14 0×01
ub1 flg_kcbh @15 0×04 (KCBHFCKV)
ub2 chkval_kcbh @16 0xc360
ub2 spare3_kcbh @18 0×0000
BBED> p tailchk
ub4 tailchk @8188 0×18720601

BBED> dump
File: /u02/oradata/kmed11/test201.dbf (8)
Block: 136 Offsets: 8188 to 8191 Dba:0×02000088
————————————————————————
01067218
<32 bytes per line>

BBED> dump file 8 block 136
File: /u02/oradata/kmed11/test201.dbf (8)
Block: 136 Offsets: 0 to 511 Dba:0×02000088
————————————————————————
06a20000 88000002 72181300 00000104 60c30000 01000000 7c230100 6c181300
00000000 03003201 80000002 ffff0000 00000000 00000000 00000000 00800000
6c181300 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00011d00
ffff4c00 9d035103 51030000 1d00801e 7f1d7e1c 941bb01a c619c518 c217c416
c615cf14 d013e312 f8110d11 12101e0f 2a0e2b0d 2f0c310b 3b0a3b09 44085707
6d067a05 89049d03 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 tailchk
ub4 tailchk @8188 0×18720601
BBED> dump
File: /u02/oradata/kmed11/test201.dbf (8)
Block: 136 Offsets: 8188 to 8191 Dba:0×02000088
————————————————————————
01067218
<32 bytes per line>

3.开始修改块信息。
BBED> modify 1000 file 8 block 136;
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /u02/oradata/kmed11/test201.dbf (8)
Block: 136 Offsets: 0 to 511 Dba:0×02000088
————————————————————————
03e80000 88000002 72181300 00000104 60c30000 01000000 7c230100 6c181300
00000000 03003201 80000002 ffff0000 00000000 00000000 00000000 00800000
6c181300 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00011d00
ffff4c00 9d035103 51030000 1d00801e 7f1d7e1c 941bb01a c619c518 c217c416
c615cf14 d013e312 f8110d11 12101e0f 2a0e2b0d 2f0c310b 3b0a3b09 44085707
6d067a05 89049d03 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> verify
DBVERIFY – Verification starting
FILE = /u02/oradata/kmed11/test201.dbf
BLOCK = 136
Block 136 is corrupt
Corrupt block relative dba: 0×02000088 (file 0, block 136)
Bad header found during verification
Data in bad block:
type: 3 format: 0 rdba: 0×02000088
last change scn: 0×0000.00131872 seq: 0×1 flg: 0×04
spare1: 0×0 spare2: 0×0 spare3: 0×0
consistency value in tail: 0×18720601
check value in block header: 0xc360
computed block checksum: 0x4a05

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
Message 531 not found; product=RDBMS; facility=BBED

BBED> sum
Check value for File 8, Block 136:
current = 0xc360, required = 0×8965

再查询kcbh
BBED> p kcbh
struct kcbh, 20 bytes @0
ub1 type_kcbh @0 0×03
ub1 frmt_kcbh @1 0xe8
ub1 spare1_kcbh @2 0×00
ub1 spare2_kcbh @3 0×00
ub4 rdba_kcbh @4 0×02000088
ub4 bas_kcbh @8 0×00131872
ub2 wrp_kcbh @12 0×0000
ub1 seq_kcbh @14 0×01
ub1 flg_kcbh @15 0×04 (KCBHFCKV)
ub2 chkval_kcbh @16 0xc360
ub2 spare3_kcbh @18 0×0000

BBED> p tailchk
ub4 tailchk @8188 0×18720601

修改块后看到type 和frmt 的信息都已经改变了。

BBED> sum apply
Check value for File 8, Block 136:
current = 0×8965, required = 0×8965

BBED> verify
DBVERIFY – Verification starting
FILE = /u02/oradata/kmed11/test201.dbf
BLOCK = 136
Block 136 is corrupt
Corrupt block relative dba: 0×02000088 (file 0, block 136)
Bad header found during verification
Data in bad block:
type: 3 format: 0 rdba: 0×02000088
last change scn: 0×0000.00131872 seq: 0×1 flg: 0×04
spare1: 0×0 spare2: 0×0 spare3: 0×0
consistency value in tail: 0×18720601
check value in block header: 0×8965
computed block checksum: 0×0
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
Message 531 not found; product=RDBMS; facility=BBED

4.查询test2.t1 表,出现了1578错误。
SQL> select count(*) from test2.t1;
select count(*) from test2.t1
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 8, block # 136)
ORA-01110: data file 8: ‘/u02/oradata/kmed11/test201.dbf’

alert 日志中显示以下信息:
Mon Dec 13 14:27:41 2010
Hex dump of (file 8, block 136) in trace file /u02/app/diag/rdbms/kmed11/kmed11/trace/kmed11_ora_4678.trc
Corrupt block relative dba: 0×02000088 (file 8, block 136)
Bad header found during multiblock buffer read
Data in bad block:
type: 3 format: 0 rdba: 0×02000088
last change scn: 0×0000.00131872 seq: 0×1 flg: 0×04
spare1: 0×0 spare2: 0×0 spare3: 0×0
consistency value in tail: 0×18720601
check value in block header: 0×8965
computed block checksum: 0×0
Reading datafile ‘/u02/oradata/kmed11/test201.dbf’ for corruption at rdba: 0×02000088 (file 8, block 136)
Reread (file 8, block 136) found same corrupt data
Mon Dec 13 14:27:41 2010
Corrupt Block Found
TSN = 8, TSNAME = TEST2
RFN = 8, BLK = 136, RDBA = 33554568
OBJN = 74620, OBJD = 74620, OBJECT = T1, SUBOBJECT =
SEGMENT OWNER = TEST2, SEGMENT TYPE = Table Segment
Errors in file /u02/app/diag/rdbms/kmed11/kmed11/trace/kmed11_ora_4678.trc (incident=15654):
ORA-01578: ORACLE data block corrupted (file # 8, block # 136)
ORA-01110: data file 8: ‘/u02/oradata/kmed11/test201.dbf’
Incident details in: /u02/app/diag/rdbms/kmed11/kmed11/incident/incdir_15654/kmed11_ora_4678_i15654.trc

trc 文件中的信息。
[oracle@kmed trace]$ vi /u02/app/diag/rdbms/kmed11/kmed11/trace/kmed11_ora_4678.trc

Corrupt block relative dba: 0×02000088 (file 8, block 136)
Bad header found during multiblock buffer read
Data in bad block:
type: 10 format: 0 rdba: 0×02000088
last change scn: 0×0000.00131872 seq: 0×1 flg: 0×04
spare1: 0×0 spare2: 0×0 spare3: 0×0
consistency value in tail: 0×18720601
check value in block header: 0×8965
computed block checksum: 0×3809
Reading datafile ‘/u02/oradata/kmed11/test201.dbf’ for corruption at rdba: 0×02000088 (file 8, block 136)
Reread (file 8, block 136) found same corrupt data
DDE rules only execution for: ORA 1110
—– START Event Driven Actions Dump —-
—- END Event Driven Actions Dump —-
—– START DDE Actions Dump —–
Executing SYNC actions
—– START DDE Action: ‘DB_STRUCTURE_INTEGRITY_CHECK’ (Async) —–
Successfully dispatched
—– END DDE Action: ‘DB_STRUCTURE_INTEGRITY_CHECK’ (SUCCESS, 6 csec) —–
Executing ASYNC actions
—– END DDE Actions Dump (total 6 csec) —–
Byte offset to file# 8 block# 136 is 1114112
Incident 14612 created, dump file: /u02/app/diag/rdbms/kmed11/kmed11/incident/incdir_14612/kmed11_ora_4678_i14612.trc
ORA-01578: ORACLE data block corrupted (file # 8, block # 136)
ORA-01110: data file 8: ‘/u02/oradata/kmed11/test201.dbf’
DDE: Problem Key ‘ORA 1110′ was flood controlled (0×1) (no incident)
ORA-01110: data file 8: ‘/u02/oradata/kmed11/test201.dbf’
Byte offset to file# 8 block# 136 is 1114112
Incident 14613 created, dump file: /u02/app/diag/rdbms/kmed11/kmed11/incident/incdir_14613/kmed11_ora_4678_i14613.trc
ORA-01578: ORACLE data block corrupted (file # 8, block # 136)
ORA-01110: data file 8: ‘/u02/oradata/kmed11/test201.dbf’

*** 2010-12-13 14:27:41.782
Hex dump of (file 8, block 136)
Dump of memory from 0x278FA000 to 0x278FC000
278FA000 0000E803 02000088 00131872 04010000 [........r.......]
278FA010 00008965 00000001 0001237C 0013186C [e.......|#..l...]
278FA020 00000000 01320003 02000080 0000FFFF [......2.........]

1.这种情况下,该如何使用bbed来恢复数据呢,我需要恢复出全部523条记录。 希望能给出操作步骤。

2.再问一个弱弱的问题,在第3步修改块信息时,03e80000 是如何算出的?
BBED> modify 1000 file 8 block 136;
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /u02/oradata/kmed11/test201.dbf (8)
Block: 136 Offsets: 0 to 511 Dba:0×02000088
————————————————————————
03e80000 88000002 72181300 00000104 60c30000 01000000 7c230100 6c181300

Trackback

no comment untill now

Add your comment now

切换到手机版