千家信息网

如何进行BBED标记坏块以及修复坏块

发表于:2024-11-15 作者:千家信息网编辑
千家信息网最后更新 2024年11月15日,如何进行BBED标记坏块以及修复坏块,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。BBED(Oracle Block B
千家信息网最后更新 2024年11月15日如何进行BBED标记坏块以及修复坏块

如何进行BBED标记坏块以及修复坏块,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

BBED(Oracle Block Browerand EDitor Tool),用来直接查看和修改数据文件数据的一个工具,是Oracle一款内部工具,可以直接修改Oracle数据文件块的内容,在一些极端恢复场景下比较有用。该工具不受Oracle支持,所以默认是没有生成可执行文件的,在使用前需要重新连接。

一. BBED介绍
BBED(Oracle Block Browerand EDitor Tool),用来直接查看和修改数据文件数据的一个工具,是Oracle一款内部工具,可以直接修改Oracle数据文件块的内容,在一些极端恢复场景下比较有用。该工具不受Oracle支持,所以默认是没有生成可执行文件的,在使用前需要重新连接。


二. BBED 的安装和使用
2.1 BBED 安装
Oracle8i 的BBED在windows 平台下的$ORACLE_HOME/bin下可以找到,9i中似乎未随软件发布,故在windows没有这个工具, 在Linux上面有,需要编译。

2.1.1 在9i/10g中连接生成bbed:
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed

2.1.2 11g中缺省的未提供BBED库文件,但是可以用10g的文件编译出来,需要先从10g中复制如下文件到相应目录,然后再执行上述连接命令,参考如下步骤:
(1)复制Oracle 10g文件

由于11g不提供bbed的编译了,所以可以从相同平台的10g中将下面几个文件拷贝到11g上:
scp $ORACLE10g_HOME/rdbms/lib/*sbbd* oralce@REMOTE_IP:$ORACLE11g_HOME/rdbms/lib

scp $ORACLE10g_HOME/rdbms/mesg/bbedus* oracle@REMOTE_IP:$ORACLE11g_HOME/rdbms/mesg/

(2)在11g数据库编译
--11G host
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed

如下示例是从10g上传到11g数据库的操作:
[oracle@rhel ~]$ cp $ORACLE_HOME/rdbms/lib/*sbbd* oracle@192.168.56.12:/u01/app/oracle/product/11.2.0/db_1/rdbms/lib
cp: target `oracle@192.168.56.12:/u01/app/oracle/product/11.2.0/db_1/rdbms/lib' is not a directory
[oracle@rhel ~]$ scp $ORACLE_HOME/rdbms/lib/*sbbd* oracle@192.168.56.12:/u01/app/oracle/product/11.2.0/db_1/rdbms/lib
oracle@192.168.56.12's password:
sbbdpt.o 100% 1863 1.8KB/s 00:00
ssbbded.o 100% 1191 1.2KB/s 00:00

[oracle@rhel ~]$ scp $ORACLE_HOME/rdbms/rdbms/mesg/bbedus* oracle@192.168.56.12:/u01/app/oracle/product/11.2.0/db_1/rdbms/mesg
oracle@192.168.56.12's password:
/u01/app/oracle/product/10.2.0.1/db_1/rdbms/rdbms/mesg/bbedus*: No such file or directory
[oracle@rhel ~]$ scp $ORACLE_HOME/rdbms/mesg/bbedus* oracle@192.168.56.12:/u01/app/oracle/product/11.2.0/db_1/rdbms/mesg
oracle@192.168.56.12's password:
bbedus.msb 100% 8704 8.5KB/s 00:00
bbedus.msg 100% 10KB 10.0KB/s 00:00
[oracle@rhel ~]$


2.2 使用BBED
BBED是Oracle 内部使用的命令,所以Oracle 不提供技术支持。 为了安全,BBED设置了口令保护,默认密码为blockedit。

一般使用bbed,都是将一些配置信息写入到一个参数文本里,在调用bbed时,指定该参数文件
(1)先获取datafile 的信息
SQL> select file#||' '||name||' '||bytes from v$datafile ;

FILE#||''||NAME||''||BYTES
------------------------------------------------------------------------------
1 /u01/app/oracle/oradata/DBdb/system01.dbf 2936012800
2 /u01/app/oracle/oradata/DBdb/sysaux01.dbf 723517440
3 /u01/app/oracle/oradata/DBdb/undotbs01.dbf 2710568960
4 /u01/app/oracle/oradata/DBdb/users01.dbf 3207331840
5 /u01/app/oracle/oradata/DBdb/example01.dbf 355205120
6 /u01/app/oracle/oradata/DBdb/tbs.dbf 12582912
7 /u01/app/oracle/oradata/DBdb/tbs_tmp.dbf 12582912

7 rows selected.

注意,这里的file id。 我们这里的file id 和 oracle 系统内部的file id 相同。 当然这个id 我们也可以自己指定。 当我们在bbed 里设置file id 时,就是根据这个参数文件中的的设置来的。 最好设置为相同,不然以后可能会混淆。

--创建parameter file
[oracle@wang ~]$ pwd
/home/oracle
[oracle@wang ~]$ cat bbed.par
blocksize=8192
listfile=/home/oracle/filelist.txt
mode=edit

-- 将上面查询出来的datafile信息保存到文本里
[oracle@wang ~]$ cat filelist.txt
6 /u01/app/oracle/oradata/DBdb/tbs.dbf 12582912
7 /u01/app/oracle/oradata/DBdb/tbs_tmp.dbf 12582912
[oracle@wang ~]$

--使用parameter file 连接bbed
[oracle@wang lib]$pwd
/u01/app/oracle/product/11.2.0/db_1/rdbms/lib
[oracle@wang lib]$ bbed parfile=/home/oracle/bbed.par
Password:

BBED: Release 2.0.0.0.0 - Limited Production on Thu Feb 1 11:24:38 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> show
FILE# 6
BLOCK# 1
OFFSET 0
DBA 0x01800001 (25165825 6,1)
FILENAME /u01/app/oracle/oradata/DBdb/tbs.dbf
BIFILE bifile.bbd
LISTFILE /home/oracle/filelist.txt
BLOCKSIZE 8192
MODE Edit
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 80
COUNT 512
LOGFILE log.bbd
SPOOL No

BBED>

三. BBED命令说明
先看帮助的说明:

BBED> help all
SET DBA [ dba | file#, block# ]
SET FILENAME 'filename'
SET FILE file#
SET BLOCK [+/-]block#
SET OFFSET [ [+/-]byte offset | symbol | *symbol ]
SET BLOCKSIZE bytes
SET LIST[FILE] 'filename'
SET WIDTH character_count
SET COUNT bytes_to_display
SET IBASE [ HEX | OCT | DEC ]
SET OBASE [ HEX | OCT | DEC ]
SET MODE [ BROWSE | EDIT ]
SET SPOOL [ Y | N ]
SHOW [ | ALL ]
INFO
MAP[/v] [ DBA | FILENAME | FILE | BLOCK ]
DUMP[/v] [ DBA | FILENAME | FILE | BLOCK | OFFSET | COUNT ]
PRINT[/x|d|u|o|c] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
EXAMINE[/Nuf] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
:
N - a number which specifies a repeat count.
u - a letter which specifies a unit size:
b - b1, ub1 (byte)
h - b2, ub2 (half-word)
w - b4, ub4(word)
r - Oracle table/index row
f - a letter which specifies a display format:
x - hexadecimal
d - decimal
u - unsigned decimal
o - octal
c - character (native)
n - Oracle number
t - Oracle date
i - Oracle rowid
FIND[/x|d|u|o|c] numeric/character string [ TOP | CURR ]
COPY [ DBA | FILE | FILENAME | BLOCK ] TO [ DBA | FILE | FILENAME | BLOCK ]
MODIFY[/x|d|u|o|c] numeric/character string
[ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
ASSIGN[/x|d|u|o] =
: [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
: [ value | ]
SUM [ DBA | FILE | FILENAME | BLOCK ] [ APPLY ]
PUSH [ DBA | FILE | FILENAME | BLOCK | OFFSET ]
POP [ALL]
REVERT [ DBA | FILE | FILENAME | BLOCK ]
UNDO
HELP [ | ALL ]
VERIFY [ DBA | FILE | FILENAME | BLOCK ]
CORRUPT [ DBA | FILE | FILENAME | BLOCK ]

BBED>
BBED> help map
MAP[/v] [ DBA | FILENAME | FILE | BLOCK ]
BBED> help verify
VERIFY [ DBA | FILE | FILENAME | BLOCK ]

下面是几个常用的:
set 设定当前的环境
show 查看当前的环境参数,跟sqlplus的同名命令类似。
dump 列出指定block的内容
find 在指定的block中查找指定的字符串,结果是显示出字符串,及其偏移量--offset,偏移量就是在block中的字节数
modify 修改指定block的指定偏移量的值,可以在线修改。
copy 把一个block的内容copy到另一个block中
verify 检查当前环境是否有坏块
sum 计算block的checksum,modify之后block就被标识为坏块,current checksum与reqired checksum不一致,sum命令可以计算出新的checksum并应用到当前块。
undo 回滚当前的修改操作,如果手误做错了,undo一下就ok了,回到原来的状态。
revert 回滚所有之前的修改操作,意思就是 undo all


四、实验BBED标记坏块以及修复坏块,如下:

1.创建表abc和表空间abc
SQL> select file_id,tablespace_name,file_name,status from dba_data_files;

FILE_ID TABLESPACE_NAME FILE_NAME STATUS
---------- --------------- --------------------------------------------- ---------
4 USERS /u01/app/oracle/oradata/DBdb/users01.dbf AVAILABLE
3 UNDOTBS1 /u01/app/oracle/oradata/DBdb/undotbs01.dbf AVAILABLE
2 SYSAUX /u01/app/oracle/oradata/DBdb/sysaux01.dbf AVAILABLE
1 SYSTEM /u01/app/oracle/oradata/DBdb/system01.dbf AVAILABLE
5 EXAMPLE /u01/app/oracle/oradata/DBdb/example01.dbf AVAILABLE
6 TBS /u01/app/oracle/oradata/DBdb/tbs.dbf AVAILABLE
7 TBS_TMP /u01/app/oracle/oradata/DBdb/tbs_tmp.dbf AVAILABLE
8 TEST /u01/app/oracle/oradata/DBdb/test01.dbf AVAILABLE

8 rows selected.

SQL>
SQL> create tablespace abc datafile '/u01/app/oracle/oradata/DBdb/abc01.dbf' size 50m;

Tablespace created.

SQL> conn scott/tiger;
Connected.
SQL>
SQL> create table scott.abc tablespace abc as select * from user_tables;

Table created.

SQL>

SQL> SELECT rowid,s.TABLE_NAME,s.TABLESPACE_NAME,s.STATUS FROM scott.abc s where rownum<5;

ROWID TABLE_NAME TABLESPACE_NAME STATUS
------------------ ------------------------------ --------------- --------
AAAV80AAJAAAACDAAA DEPT USERS VALID
AAAV80AAJAAAACDAAB EMP USERS VALID
AAAV80AAJAAAACDAAC BONUS USERS VALID
AAAV80AAJAAAACDAAD JOBS USERS VALID

SQL>

--根据rowid,查询file#,rel_fno,blockno等信息
select rowid,
dbms_rowid.rowid_to_absolute_fno('AAAV80AAJAAAACDAAA','SCOTT','ABC') file#,
dbms_rowid.rowid_object('AAAV80AAJAAAACDAAA') objid,
dbms_rowid.rowid_relative_fno('AAAV80AAJAAAACDAAA') rel_fno,
dbms_rowid.rowid_block_number('AAAV80AAJAAAACDAAA') blockno,
dbms_rowid.rowid_row_number('AAAV80AAJAAAACDAAA') rownumb
from dual;

SQL> select rowid,
2 dbms_rowid.rowid_to_absolute_fno('AAAV80AAJAAAACDAAA','SCOTT','ABC') file#,
3 dbms_rowid.rowid_object('AAAV80AAJAAAACDAAA') objid,
4 dbms_rowid.rowid_relative_fno('AAAV80AAJAAAACDAAA') rel_fno,
5 dbms_rowid.rowid_block_number('AAAV80AAJAAAACDAAA') blockno,
6 dbms_rowid.rowid_row_number('AAAV80AAJAAAACDAAA') rownumb
7 from dual;

ROWID FILE# OBJID REL_FNO BLOCKNO ROWNUMB
------------------ ---------- ---------- ---------- ---------- ----------
AAAAB0AABAAAAOhAAA 9 89908 9 131 0

--根据file#,blockno等信息查询表信息
SELECT owner, segment_name,segment_type,relative_fno,tablespace_name
FROM dba_extents
WHERE file_id = &AFN
and &BL between block_id AND block_id + blocks - 1;

SQL> conn / as sydba
Connected.
SQL> SELECT owner, segment_name,segment_type,relative_fno,tablespace_name
2 FROM dba_extents
3 WHERE file_id = &AFN
4 and &BL between block_id AND block_id + blocks - 1;
Enter value for afn: 9
old 3: WHERE file_id = &AFN
new 3: WHERE file_id = 9
Enter value for bl: 131
old 4: and &BL between block_id AND block_id + blocks - 1
new 4: and 131 between block_id AND block_id + blocks - 1

OWNER SEGMENT_NAME SEGMENT_TYPE RELATIVE_FNO TABLESPACE_NAME
------------ ------------------ ------------------ ------------ ---------------
SCOTT ABC TABLE 9 ABC

SQL>
SQL> SELECT owner,tablespace_name,extent_id,file_id,block_id,bytes,blocks FROM dba_extents WHERE segment_name='ABC';

OWNER TABLESPACE_NAME EXTENT_ID FILE_ID BLOCK_ID BYTES BLOCKS
------------------------------ --------------- ---------- ---------- ---------- ---------- ----------
SCOTT ABC 0 9 128 65536 8

2.使用bbed修改块,使其变为坏块;
模拟查找要进行破坏的块号:
select dbms_rowid.rowid_object(rowid) obj#,
dbms_rowid.rowid_to_absolute_fno(rowid, 'SCOTT', 'ABC') file#,
dbms_rowid.rowid_relative_fno(rowid) rfile#,
dbms_rowid.rowid_block_number(rowid) block#,
dbms_rowid.rowid_row_number(rowid) row#
from scott.abc
where rownum = 1;

SQL> select dbms_rowid.rowid_object(rowid) obj#,
2 dbms_rowid.rowid_to_absolute_fno(rowid, 'SCOTT', 'ABC') file#,
3 dbms_rowid.rowid_relative_fno(rowid) rfile#,
4 dbms_rowid.rowid_block_number(rowid) block#,
5 dbms_rowid.rowid_row_number(rowid) row#
6 from scott.abc
7 where rownum = 1;

OBJ# FILE# RFILE# BLOCK# ROW#
---------- ---------- ---------- ---------- ----------
89908 9 9 131 0

2.1 查询信息:
SQL> select file#||' '||name||' '||bytes from v$datafile ;

FILE#||''||NAME||''||BYTES
--------------------------------------------------------------------------------
1 /u01/app/oracle/oradata/DBdb/system01.dbf 2936012800
2 /u01/app/oracle/oradata/DBdb/sysaux01.dbf 723517440
3 /u01/app/oracle/oradata/DBdb/undotbs01.dbf 2710568960
4 /u01/app/oracle/oradata/DBdb/users01.dbf 3207331840
5 /u01/app/oracle/oradata/DBdb/example01.dbf 355205120
6 /u01/app/oracle/oradata/DBdb/tbs.dbf 12582912
7 /u01/app/oracle/oradata/DBdb/tbs_tmp.dbf 12582912
8 /u01/app/oracle/oradata/DBdb/test01.dbf 31457280
9 /u01/app/oracle/oradata/DBdb/abc01.dbf 52428800

9 rows selected.

SQL>

2.2将abc表空间的信息添加到filelist文件中:
[oracle@wang ~]$ cat filelist.txt
9 /u01/app/oracle/oradata/DBdb/abc01.dbf 52428800
[oracle@wang ~]$

2.3 编辑bbed的parfile文件:
[oracle@wang ~]$ cat bbed.par
blocksize=8192
listfile=/home/oracle/filelist.txt
mode=edit
[oracle@wang ~]$

2.4 进入bbed:
[oracle@wang lib]$ bbed parfile=/home/oracle/bbed.par
Password:

BBED: Release 2.0.0.0.0 - Limited Production on Thu Feb 1 15:24:01 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> show
FILE# 9
BLOCK# 1
OFFSET 0
DBA 0x02400001 (37748737 9,1)
FILENAME /u01/app/oracle/oradata/DBdb/abc01.dbf
BIFILE bifile.bbd
LISTFILE /home/oracle/filelist.txt
BLOCKSIZE 8192
MODE Edit
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 80
COUNT 512
LOGFILE log.bbd
SPOOL No

BBED>
BBED> set file 9 block 131
FILE# 9
BLOCK# 131

BBED> map
File: /u01/app/oracle/oradata/DBdb/abc01.dbf (9)
Block: 131 Dba:0x02400083
------------------------------------------------------------
KTB Data Block (Table/Cluster)

struct kcbh, 20 bytes @0

struct ktbbh, 96 bytes @20

struct kdbh, 14 bytes @124

struct kdbt[1], 4 bytes @138

sb2 kdbr[5] @142

ub1 freespace[6899] @152

ub1 rowdata[1137] @7051

ub4 tailchk @8188


BBED>
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 0x02400083
ub4 bas_kcbh @8 0x003a7f7b
ub2 wrp_kcbh @12 0x0000
ub1 seq_kcbh @14 0x02
ub1 flg_kcbh @15 0x04 (KCBHFCKV)
ub2 chkval_kcbh @16 0xb3d6
ub2 spare3_kcbh @18 0x0000

BBED>
--修改,如下:
BBED> modify /x ff offset 14
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /u01/app/oracle/oradata/DBdb/abc01.dbf (9)
Block: 131 Offsets: 14 to 525 Dba:0x02400083
------------------------------------------------------------------------
ff04d6b3 00000100 0000345f 0100797f 3a000000 00000300 32008000 4002ffff
00000000 00000000 00000000 00000080 0000797f 3a000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000001 0500ffff 1c000f1b f31af31a 00000500
981eaf1d dc1cf41b 0f1b0000 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 00000000

<32 bytes per line>

--再次查询:
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 0x02400083
ub4 bas_kcbh @8 0x003a7f7b
ub2 wrp_kcbh @12 0x0000
ub1 seq_kcbh @14 0xff
ub1 flg_kcbh @15 0x04 (KCBHFCKV)
ub2 chkval_kcbh @16 0xb3d6
ub2 spare3_kcbh @18 0x0000

BBED>

--应用,确认修改:
BBED> sum apply
Check value for File 9, Block 131:
current = 0xb32b, required = 0xb32b

2.5 使用dbv工具检查,发现坏块:(file 9, block 131)
[oracle@wang ~]$ dbv file=/u01/app/oracle/oradata/DBdb/abc01.dbf

DBVERIFY: Release 11.2.0.4.0 - Production on Thu Feb 1 15:36:47 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/DBdb/abc01.dbf
Page 131 is influx - most likely media corrupt
Corrupt block relative dba: 0x02400083 (file 9, block 131)
Fractured block found during dbv:
Data in bad block:
type: 6 format: 2 rdba: 0x02400083
last change scn: 0x0000.003a7f7b seq: 0xff flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x7f7b0602
check value in block header: 0xb32b
computed block checksum: 0x0



DBVERIFY - Verification complete

Total Pages Examined : 6400
Total Pages Processed (Data) : 1242
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 155
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 5002
Total Pages Marked Corrupt : 1
Total Pages Influx : 1
Total Pages Encrypted : 0
Highest block SCN : 3833726 (0.3833726)
[oracle@wang ~]$


3.使用bbed修复该块:
当出现ora-01578错误时,oracle会设置块的序列号为0xff,在块中位置为kcbh.seq_kcbh.

[oracle@wang lib]$ bbed parfile=/home/oracle/bbed.par
Password:

BBED: Release 2.0.0.0.0 - Limited Production on Thu Feb 1 15:39:24 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED> show
FILE# 9
BLOCK# 1
OFFSET 0
DBA 0x02400001 (37748737 9,1)
FILENAME /u01/app/oracle/oradata/DBdb/abc01.dbf
BIFILE bifile.bbd
LISTFILE /home/oracle/filelist.txt
BLOCKSIZE 8192
MODE Edit
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 80
COUNT 512
LOGFILE log.bbd
SPOOL No

BBED> help verify
VERIFY [ DBA | FILE | FILENAME | BLOCK ]

--切换到file 9 block 131,检查发现坏块,如下:
BBED> set file 9 block 131
FILE# 9
BLOCK# 131

BBED> show
FILE# 9
BLOCK# 131
OFFSET 0
DBA 0x02400083 (37748867 9,131)
FILENAME /u01/app/oracle/oradata/DBdb/abc01.dbf
BIFILE bifile.bbd
LISTFILE /home/oracle/filelist.txt
BLOCKSIZE 8192
MODE Edit
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 80
COUNT 512
LOGFILE log.bbd
SPOOL No

BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle/oradata/DBdb/abc01.dbf
BLOCK = 131

Block 131 is corrupt
Corrupt block relative dba: 0x02400083 (file 0, block 131)
Fractured block found during verification
Data in bad block:
type: 6 format: 2 rdba: 0x02400083
last change scn: 0x0000.003a7f7b seq: 0xff flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x7f7b0602
check value in block header: 0xb32b
computed block checksum: 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 : 2
Message 531 not found; product=RDBMS; facility=BBED

--开始进行修复:
BBED> map
File: /u01/app/oracle/oradata/DBdb/abc01.dbf (9)
Block: 131 Dba:0x02400083
------------------------------------------------------------
KTB Data Block (Table/Cluster)

struct kcbh, 20 bytes @0

struct ktbbh, 96 bytes @20

struct kdbh, 14 bytes @124

struct kdbt[1], 4 bytes @138

sb2 kdbr[5] @142

ub1 freespace[6899] @152

ub1 rowdata[1137] @7051

ub4 tailchk @8188

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 0x02400083
ub4 bas_kcbh @8 0x003a7f7b
ub2 wrp_kcbh @12 0x0000
ub1 seq_kcbh @14 0xff
ub1 flg_kcbh @15 0x04 (KCBHFCKV)
ub2 chkval_kcbh @16 0xb32b
ub2 spare3_kcbh @18 0x0000


--这里tailchk信息正确,无需修改,如下:
BBED> p tailchk
ub4 tailchk @8188 0x7f7b0602

--修改为原来的02
BBED> modify /x 02 offset 14
File: /u01/app/oracle/oradata/DBdb/abc01.dbf (9)
Block: 131 Offsets: 14 to 525 Dba:0x02400083
------------------------------------------------------------------------
0204d5b3 00000100 0000345f 0100797f 3a000000 00000300 32008000 4002ffff
00000000 00000000 00000000 00000080 0000797f 3a000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000001 0500ffff 1c000f1b f31af31a 00000500
981eaf1d dc1cf41b 0f1b0000 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 00000000

<32 bytes per line>

--验证
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 0x02400083
ub4 bas_kcbh @8 0x003a7f7b
ub2 wrp_kcbh @12 0x0000
ub1 seq_kcbh @14 0x02
ub1 flg_kcbh @15 0x04 (KCBHFCKV)
ub2 chkval_kcbh @16 0xb3d5
ub2 spare3_kcbh @18 0x0000

--应用
BBED> sum apply
Check value for File 9, Block 131:
current = 0xb3d6, required = 0xb3d6

--再次检测,发现坏块消失
BBED> verify
DBVERIFY - Verification starting
FILE = /u01/app/oracle/oradata/DBdb/abc01.dbf
BLOCK = 131


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


BBED>

4. 使用dbv工具也没有发现坏块
[oracle@wang ~]$ dbv file=/u01/app/oracle/oradata/DBdb/abc01.dbf

DBVERIFY: Release 11.2.0.4.0 - Production on Thu Feb 1 15:56:44 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/DBdb/abc01.dbf


DBVERIFY - Verification complete

Total Pages Examined : 6400
Total Pages Processed (Data) : 1243
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 155
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 5002
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 3833726 (0.3833726)
[oracle@wang ~]$
[oracle@wang ~]$

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注行业资讯频道,感谢您对的支持。

0