十一、假如有一天我们没有了BBED
昨天,eygle和我又联手处理了一起恢复的实例,依然是毫无例外的用到了BBED。我们在处理复杂恢复案例时实际上是处于一种对BBED的高度依赖状态。

昨天回到家里,我就在想—-假如有一天我们没有了BBED,我们该怎么办?

其实BBED/KFED对我而言,最方便的地方就是它们在sum apply/merge时可以帮我算checksum值,而我并知道oracle计算checksum值的算法。

虽然我不知道oracle计算checksum值的算法,但是幸好我们有dbv,即我们可以根据dbv的结果反推出checksum值。所以上述问题的答案就是—-如果我们熟悉oracle的各种block的格式和些许oracle internal的机制,再加上用好如下这4种工具,则就完全可以取代BBED了,这4种工具是:
1、 dd
2、 ultraEdit
3、 dbv
4、 ODU

我们来看一个利用dbv反推出checksum值的实例:
[P550_04_LA:oracle@:/cadrasu01/app/oracle/product/9.2.0/bin]#dbv file=/dras20/testdb/system01.dbf blocksize=8192

DBVERIFY: Release 9.2.0.6.0 – Production on Fri Aug 6 12:20:37 2010

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

DBVERIFY – Verification starting : FILE = /dras20/testdb/system01.dbf
Page 730 is marked corrupt
***
Corrupt block relative dba: 0x004002da (file 1, block 730)
Bad check value found during dbv:
Data in bad block -
type: 6 format: 2 rdba: 0x004002da
last change scn: 0×0000.000aec3f seq: 0×1 flg: 0×06
consistency value in tail: 0xec3f0601
check value in block header: 0xd372, computed block checksum: 0×4
spare1: 0×0, spare2: 0×0, spare3: 0×0
***
DBVERIFY – Verification complete

Total Pages Examined : 52480
Total Pages Processed (Data) : 36707
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 4431
Total Pages Failing (Index): 0
Total Pages Processed (Other): 1752
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 9589
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Highest block SCN : 718416 (0.718416)

注意这里面有一句话:
check value in block header: 0xd372, computed block checksum: 0×4
oracle的意思就是说你这个block里块头记录的checksum值是0xd372,而实际上oracle根据其内置的checksum值算法计算出来的这个block的checksum值应该是0xXXXX,且0xXXXX和0xd372做异或操作后的值是0×4。

根据异或操作的定义,我们极其容易反推出0xXXXX = 0xd376
BBED> set offset 16
OFFSET 16

BBED> dump
File: /dras20/testdb/system01.dbf (1)
Block: 730 Offsets: 16 to 527 Dba:0x004002da
————————————————————————
d3720000 01000000 000076a9 000aa0f0 00000000 00020300 00000000 000c0004
00000140 02c00abb 002a4300 20020000 000aa133 0013000b 000000b1 02c00256
……省略显示部分内容
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

<32 bytes per line>

BBED> modify /x d376
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /dras20/testdb/system01.dbf (1)
Block: 730 Offsets: 16 to 527 Dba:0x004002da
————————————————————————
d3760000 01000000 000076a9 000aa0f0 00000000 00020300 00000000 000c0004
00000140 02c00abb 002a4300 20020000 000aa133 0013000b 000000b1 02c00256
……省略显示部分内容
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

<32 bytes per line>

BBED> exit —-注意这里我没有执行sum apply就直接退出了

现在我们再次执行dbv,oracle此时已经不报错了:
[P550_04_LA:oracle@:/cadrasu01/app/oracle/product/9.2.0/bin]#dbv file=/dras20/testdb/system01.dbf blocksize=8192

DBVERIFY: Release 9.2.0.6.0 – Production on Fri Aug 6 16:55:59 2010

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

DBVERIFY – Verification starting : FILE = /dras20/testdb/system01.dbf

DBVERIFY – Verification complete

Total Pages Examined : 52480
Total Pages Processed (Data) : 36708
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 4431
Total Pages Failing (Index): 0
Total Pages Processed (Other): 1752
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 9589
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 718416 (0.718416)

即上述block正确的checksum值就是0xd376。

Trackback

no comment untill now

Add your comment now

切换到手机版