使用bbed 修改数据块物理校验出错的问题。
SQL> select * from yangtab;
select * from yangtab
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 4, block # 388)
ORA-01110: data file 4: '/opt/oracle/oradata/orcl/users01.dbf'
使用dbv 进行验证。
oracle@localhost.localdomain:/home/oracle>dbv file=/opt/oracle/oradata/orcl/users01.dbf
DBVERIFY: Release 10.2.0.1.0 - Production on Sun Aug 7 20:01:34 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = /opt/oracle/oradata/orcl/users01.dbf
Page 388 is marked corrupt
Corrupt block relative dba: 0x01000184 (file 4, block 388)
Bad header found during dbv:
Data in bad block:
type: 6 format: 2 rdba: 0x0100018c与本来应该的rdba 0x01000184不一致。
last change scn: 0x0000.000b0c25 seq: 0x2 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x0c250602
check value in block header: 0x24df
computed block checksum: 0x0
#Block Checking: DBA = 16777612, Block Type = KTB-managed data block
#data header at 0x2b92e120827c
#kdbchk: the amount of space used is not equal to block size
# used=613 fsc=41 avsp=7451 dtl=8064
#Page 396 failed with check code 6110--这是另一个问题,查看技术解决。
DBVERIFY - Verification complete
Total Pages Examined : 640
Total Pages Processed (Data) : 45
Total Pages Failing (Data) : 1
Total Pages Processed (Index): 63
Total Pages Failing (Index): 0
Total Pages Processed (Other): 142
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 389
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Highest block SCN : 747176 (0.747176)
从上面dbv检查的信息查看,数据块388的错误信息属于数据块的物理校验Block Misplaced
解决方法是使用bbed 修改kcbh.rdba_kcbh 的值和Corrupt block relative dba: 0x01000184 (file 4, block 388)中的rdba一致。
BBED> set dba 4,388
DBA 0x01000184 (16777604 4,388)
BBED> p kcbh
struct kcbh, 20 bytes @0
ub1 type_kcbh @0 0x06
ub1 frmt_kcbh @1 0xa2
ub1 spare1_kcbh @2 0x00
ub1 spare2_kcbh @3 0x00
ub4 rdba_kcbh @4 0x0100018c
ub4 bas_kcbh @8 0x000b0c25
ub2 wrp_kcbh @12 0x0000
ub1 seq_kcbh @14 0x02
ub1 flg_kcbh @15 0x04 (KCBHFCKV)
ub2 chkval_kcbh @16 0x24df
ub2 spare3_kcbh @18 0x0000
BBED> set dba 4,388 offset 4
DBA 0x01000184 (16777604 4,388)
OFFSET 4
BBED> dump /v dba 4,388 offset 4 count 64
File: /opt/oracle/oradata/orcl/users01.dbf (4)
Block: 388 Offsets: 4 to 67 Dba:0x01000184
-------------------------------------------------------
8c010001 250c0b00 00000204 df240000 l ....%........$..
01000000 2ecd0000 240c0b00 00000000 l ........$.......
03003200 89010001 ffff0000 00000000 l ..2.............
00000000 00000000 00800000 240c0b00 l ............$...
注意0x0100018c 在块里的存储方式是低位优先的:8c010001
BBED> modify /x 84
File: /opt/oracle/oradata/orcl/users01.dbf (4)
Block: 388 Offsets: 4 to 67 Dba:0x01000184
------------------------------------------------------------------------
84010001 250c0b00 00000204 df240000 01000000 2ecd0000 240c0b00 00000000
03003200 89010001 ffff0000 00000000 00000000 00000000 00800000 240c0b00
重新应用校验和。
BBED> sum dba 4,388
Check value for File 4, Block 388:
current = 0x24df, required = 0x24d7
BBED> sum dba 4,388 apply
Check value for File 4, Block 388:
current = 0x24d7, required = 0x24d7
在bbed中进行检查,坏块已经修复。
BBED> verify
DBVERIFY - Verification starting
FILE = /opt/oracle/oradata/orcl/users01.dbf
BLOCK = 388
DBVERIFY - Verification complete
Total Blocks Examined : 1
Total Blocks Processed (Data) : 1
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
数据库中检查,成功。
SQL> select * from yangtab;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- --------------- ---------- ---------- ------------------ ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 yang SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.