欢迎投稿

今日深度:

BBED标记坏块以及修复坏块,bbed标记

BBED标记坏块以及修复坏块,bbed标记


创建测试表:

ZBDBA@orcl11g>select * from zbdba;
NAME
------------------------------------------------------------
zbdba
huihui

ZBDBA@orcl11g>
ZBDBA@orcl11g>
ZBDBA@orcl11g>
ZBDBA@orcl11g>
ZBDBA@orcl11g>select rowid,dbms_rowid.rowid_object(rowid) robject,
  2  dbms_rowid.rowid_relative_fno(rowid) fno,
  3  dbms_rowid.rowid_block_number(rowid) bno,
  4  dbms_rowid.rowid_row_number(rowid) rno from zbdba where rownum=1;

ROWID                 ROBJECT        FNO        BNO        RNO
------------------ ---------- ---------- ---------- ----------
AAASMNAAGAAAAC/AAA      74509          6        191          0



使用bbed修改块状态:

BBED> set file 6 block 191
        FILE#           6
        BLOCK#          191

BBED> map
File: /opt/oracle/oradata/orcl11g/zbdba01.dbf (6)
Block: 191                                   Dba:0x018000bf
------------------------------------------------------------
KTB Data Block (Table/Cluster)

struct kcbh, 20 bytes                      @0      

struct ktbbh, 72 bytes                     @20     

struct kdbh, 14 bytes                      @100    

struct kdbt[1], 4 bytes                    @114    

sb2 kdbr[2]                                @118    

ub1 freespace[8047]                        @122    

ub1 rowdata[19]                            @8169   

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        0x018000bf
   ub4 bas_kcbh                             @8        0x005036cd
   ub2 wrp_kcbh                             @12       0x0000
   ub1 seq_kcbh                             @14       0x01
   ub1 flg_kcbh                             @15       0x06 (KCBHFDLC, KCBHFCKV)
   ub2 chkval_kcbh                          @16       0x426d
   ub2 spare3_kcbh                          @18       0x0000

BBED> modify /x ff offset 14
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /opt/oracle/oradata/orcl11g/zbdba01.dbf (6)
Block: 191              Offsets:   14 to  525           Dba:0x018000bf
------------------------------------------------------------------------
ff066d42 00000100 00000d23 01009636 50000000 00000200 3200b800 80011300
02001800 0000e90b 80021100 38000220 0000cd36 50000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000001 0200ffff 1600851f
6f1f6f1f 00000200 8f1f851f 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
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        0x018000bf
   ub4 bas_kcbh                             @8        0x005036cd
   ub2 wrp_kcbh                             @12       0x0000
   ub1 seq_kcbh                             @14       0xff
   ub1 flg_kcbh                             @15       0x06 (KCBHFDLC, KCBHFCKV)
   ub2 chkval_kcbh                          @16       0x426d
   ub2 spare3_kcbh                          @18       0x0000

BBED> sum apply
Check value for File 6, Block 191:
current = 0x4293, required = 0x4293
再回数据库查看该表:

ZBDBA@orcl11g>select * from zbdba;
select * from zbdba
              *
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 6, block # 191)
ORA-01110: data file 6: '/opt/oracle/oradata/orcl11g/zbdba01.dbf'


常规坏块的处理方式:
1、event 10231
2、rowid抽取
3、DBMS_REPAIR

这里我用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        0x018000bf
   ub4 bas_kcbh                             @8        0x005036cd
   ub2 wrp_kcbh                             @12       0x0000
   ub1 seq_kcbh                             @14       0xff
   ub1 flg_kcbh                             @15       0x06 (KCBHFDLC, KCBHFCKV)
   ub2 chkval_kcbh                          @16       0x4293
   ub2 spare3_kcbh                          @18       0x0000

BBED> p tailchk
ub4 tailchk                                 @8188     0x36cd0601
这里tailchk信息正确,无需修改

BBED> modify /x 01 offset 14
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /opt/oracle/oradata/orcl11g/zbdba01.dbf (6)
Block: 191              Offsets:   14 to  525           Dba:0x018000bf
------------------------------------------------------------------------
01069342 00000100 00000d23 01009636 50000000 00000200 3200b800 80011300
02001800 0000e90b 80021100 38000220 0000cd36 50000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000001 0200ffff 1600851f
6f1f6f1f 00000200 8f1f851f 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
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        0x018000bf
   ub4 bas_kcbh                             @8        0x005036cd
   ub2 wrp_kcbh                             @12       0x0000
   ub1 seq_kcbh                             @14       0x01
   ub1 flg_kcbh                             @15       0x06 (KCBHFDLC, KCBHFCKV)
   ub2 chkval_kcbh                          @16       0x4293
   ub2 spare3_kcbh                          @18       0x0000

BBED> sum apply
Check value for File 6, Block 191:
current = 0x426d, required = 0x426d

BBED> verify
DBVERIFY - Verification starting
FILE = /opt/oracle/oradata/orcl11g/zbdba01.dbf
BLOCK = 191


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
再次去数据库查询:

ZBDBA@orcl11g>select * from zbdba;
NAME
------------------------------------------------------------
zbdba
huihui






u盘有坏块可以不可以不修复?

坏块 数量少,是可以修复的, 方法是 把U盘量产一次,使U盘成为系统启动盘;
【注意:是"量产" U盘 】

坏块多的话,应该是不可能修复的,除非拿到生产厂家去修复~~~~~~
 

怎隐藏坏块

你硬盘上的数据要是无关紧要,就先完全格式化一下,这样可以标记出坏扇区,再执行Scandisk/all;如果要保留数据,那就用Scandisk/all扫描一遍硬盘,让其标记出坏扇区。然后按Pause暂停扫描,现在可以看到有几个用红色“B”标记的坏块,这就开始修复工作。

首先,记下每个坏块在这个图中的相对位置,即每个坏块之前的“好块”有多大,占整个硬盘的百分几,得出这些数据后,就可到PQMagic中进行分区了。以我的硬盘(3.2G)为例来进行说明。

坏块前面的好块占整个硬盘的百分比150%22.5%第一个坏块之前的好块大小为50%×3.2G=1.6G;第二个坏块之前的好块大小为2.5%×3.2G=80M;剩下的部分为完好的扇区大小为1.52G。于是先将硬盘归划出这三个分区,再大致计算一下一个坏块大约为几M,在包含有坏块的分区中将其分离出,并隐藏。如果觉得计算坏块大小麻烦,那就这样做:估计一下坏块大小,比如说40M(起先大一些没关系),然后将其分隔开,能顺利完成,表明没碰到坏块,且坏块已被分到新分区中,为40M,若觉得丢掉40M太浪费了,还可以将此分区缩小,看看坏块大约靠近哪边,就往远离坏块的一边先缩进,一点一点的缩小,直到碰到坏块不能改变大小。这样做,运气好的话,可以将坏块缩到很小的范围,不过不推荐将坏区缩得太小,因为如果太小,使用数据时,坏块有可能影响到好的扇区,引起更多的坏块。当今的硬盘都如此巨大,丢掉一两百兆空间算什么,关键是能安全使用硬盘的其它部分。

这种方法很有效,避免了计算大量数据的烦脑,且不易出错,容易操作。这是我在自己修理硬盘时发现的方法,感觉不错,拿出来与大家共享。
 

www.htsjk.Com true http://www.htsjk.com/shujukunews/4390.html NewsArticle BBED标记坏块以及修复坏块,bbed标记 创建测试表: ZBDBA@orcl11gselect * from zbdba;NAME------------------------------------------------------------zbdbahuihuiZBDBA@orcl11gZBDBA@orcl11gZBDBA@orcl11gZBDBA@orcl11gZBDBA@orcl11g...
评论暂时关闭