Chinaunix首页 | 论坛 | 博客
  • 博客访问: 647123
  • 博文数量: 168
  • 博客积分: 2928
  • 博客等级: 中校
  • 技术积分: 1904
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-04 09:56
文章分类

全部博文(168)

文章存档

2010年(168)

我的朋友

分类: Oracle

2010-01-19 12:03:23

  Oracle BBED 工具介绍 收藏
 
BBED(Oracle Block Brower and EDitor Tool),用来直接查看和修改数据文件数据的一个工具,是Oracle一款内部工具,可以直接修改Oracle数据文件块的内容,在一些极端恢复场景下比较有用。该工具不受Oracle支持,所以默认是没有生成可执行文件的,在使用前需要重新连接。
 
 
一.BBED 的安装
 
BBED在windows 8i中在$ORACLE_HOME/bin下可以找到,9i中似乎未随软件发布,故

在windows没有这个工具,

 
在linux上面有,需要编译。
 
在9i/10g中连接生成bbed:
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed
以上生成的bbed可执行文件在$ORACLE_HOME/rdbms/lib目录,可以复制到其他位置或者其他同Oracle版本的机器上运行。也可通过以下命令将bbed生成到$ORACLE_HOME/bin目录
make -f ins_rdbms.mk BBED=$ORACLE_HOME/bin/bbed $ORACLE_HOME/bin/bbed
 
在11g中生成bbed,需要先从10g中复制如下文件到相应目录,然后再执行上述连接命令:
$ORACLE_HOME/rdbms/lib/ssbbded.o
$ORACLE_HOME/rdbms/lib/sbbdpt.o
$ORACLE_HOME/rdbms/mesg/bbedus.msb
 
BBED设置了口令保护,密码为blockedit。
 
BBED的命令行参数:
$bbed help=yes
PASSWORD - Required parameter
FILENAME - Database file name
BLOCKSIZE - Database block size
LISTFILE - List file name
MODE - [browse/edit]
SPOOL - Spool to logfile [no/yes]
CMDFILE - BBED command file name
LOGFILE - BBED log file name
PARFILE - Parameter file name
BIFILE - BBED before-image file name
REVERT - Rollback changes from BIFILE [no/yes]
SILENT - Hide banner [no/yes]
HELP - Show all valid parameters [no/yes]
 
一般将一些常用选项写入到一个parfile中,比如
bbed.par 文件内容:
blocksize=8192
listfile=filelist.txt
mode=edit
其中filelist.txt列出了需要使用BBED编辑的数据文件列表,格式为:文件编号 文件名字 文件大小, 可通过该语句查询
SQL> select file#, name, bytes from v$datafile;
     FILE# NAME                           BYTES
---------- ------------------------------------------------ ----------
         1 /export/home/oradata/orcl/system01.dbf    450887680
         2 /export/home/oradata/orcl/undotbs01.dbf   209715200
         3 /export/home/oradata/orcl/sysaux01.dbf    188743680
         4 /export/home/oradata/orcl/users01.dbf       5242880
 
将查询结果作为filelist.txt的内容即可。这里的文件编号不一定要和数据库里的file_id相同,当然最好能设置相同,以免在处理过程中搞混淆了。
 
编好了就可以运行bbed了
[oracle@vm1 oracle]$ bbed parfile=bbed.par
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Sat Dec 12 00:38:50 2009
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> help
HELP [ | ALL ]
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>
 
下面是几个常用的:
 
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
 
二. 实验测试
先建个表,插入1条数据。
SQL> create table dave(name varchar(20)) tablespace users;
Table created.
SQL> insert into dave values(‘dmm’);
1 row created.
SQL> commit;
Commit complete.
SQL>select segment_name,file_id,block_id,blocks from dba_extents
where segment_name='DAVE'; -- 名称要大写,不然查不到结果
 
SEGMENT_NA    FILE_ID   BLOCK_ID     BLOCKS
----------           ----------      ----------     ----------
DAVE                  4         17          8
表存放在file 4 block 17: 17+8 上面.
 
先关闭数据库,对users数据文件作个cp。
SQL> shutdown immediate
[oracle@vm1 test]$ cp users01.dbf users01.dbf.bak
SQL> startup

重新启动完数据库,进入bbed
$ ./bbed parfile=bbed.par
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Sat Dec 12 01:10:34 2009
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> set file 4
        FILE#           4
BBED> show
        FILE#           4
        BLOCK#          1
        OFFSET          0
        DBA             0x01000001 (16777217 4,1)
        FILENAME        /export/home/oradata/orcl/users01.dbf
        BIFILE          bifile.bbd
        LISTFILE        filelist.txt
        BLOCKSIZE       8192
        MODE            Edit
        EDIT            Unrecoverable
        IBASE           Dec
        OBASE           Dec
        WIDTH           80
        COUNT           512
        LOGFILE         log.bbd
        SPOOL           No

刚才创建的dave表在file 4 blcok 17 - 17+8上面,用bbed看看17的内容
BBED> dump file 4 block 17 count 512
 File: /export/home/oradata/orcl/users01.dbf (4)
 Block: 17               Offsets:    0 to  511           Dba:0x01000011
------------------------------------------------------------------------
 00a20000 11000000 00000000 00000105 11a70000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 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>

offset 偏移量 从 0 到 511 单位是字节,数据块是8k的,想看完全就要扩大offset的范围

BBED> dump file 4 block 9 count 8200
File: /export/home/oradata/orcl/users01.dbf (4)
 Block: 17                Offsets:    0 to 8191           Dba:0x01000011
------------------------------------------------------------------------
 20a20000 09000001 99210700 00000204 6f7f0000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 04000000 ffffffff 00000000 03000000 08000000
 01000100 00000000 00000000 00000000 05000000 03000000 e577224b e577224b
 00000000 00000000 00000000 00000000 0a000001 00000000 00000000 08000000
 08000000 11000001 00000000 00000000 00000000 05000000 00000000 01000000
 12b90000 00000000 00000000 09000001 08000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 11155555 00000000 00000000 00000000 00000000
  … …
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 02209921
<32 bytes per line>
BBED>

Offsets: 0 to 8191 1024 * 8 = 8192个字节,正好8K。在这段数字中,有一个就是我们插入的数字. 可以通过一下方式查看。
 
SQL> select * from dave;
NAME
--------------------
Dmm
SQL> select dump('d',1016) from dual;
DUMP('D',1016)
--------------------------------------
Typ=96 Len=1 CharacterSet=AL32UTF8: 64
 
SQL> select dump('m',1016) from dual;
DUMP('M',1016)
--------------------------------------
Typ=96 Len=1 CharacterSet=AL32UTF8: 6d
SQL> select dump(‘dmm’,1016) from dual;
DUMP('DUMP',1016)
-----------------------------------------------
Typ=96 Len=4 CharacterSet=AL32UTF8: 64,75,6d,70
 
字符串’DMM’对应的16进制编码是64,75,6d,70。如果数据量大的话,可以用find命令查找
BBED> help find
FIND[/x|d|u|o|c] numeric/character string [ TOP | CURR ]
BBED> set file 4
        FILE#           4
BBED> set block 17
        BLOCK#          17
BBED> find 75 curr
File: /export/home/oradata/orcl/users01.dbf (4)
 Block: 17               Offsets:  123 to 8191           Dba:0x01000011
------------------------------------------------------------------------
 4bd68222 4b000000 00000000 00000000 00000000 00120000 01000000 00000000
 00080000 00080000 00190000 01000000 00000000 00000000 00050000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 000220ed 35

在find之前先设置想要查找的 file 和 block,默认是十进制的ascii编码,/x 表示16进制,find的结果显示出offset,即字符出现的位置。
 
我们将刚才查出来的偏移量进行修改:
BBED> help modify
MODIFY[/x|d|u|o|c] numeric/character string
[ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]

BBED> modify 98 file 4 block 17 offset 123
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
 File: /export/home/oradata/orcl/users01.dbf (4)
 Block: 17               Offsets:  123 to  634           Dba:0x01000011
------------------------------------------------------------------------
 62d68222 4b000000 00000000 00000000 00000000 00120000 01000000 00000000
 00080000 00080000 00190000 01000000 00000000 00000000 00050000 00000000
 00010000 001ab900 00000000 00000000 00110000 01080000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00111555 55000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 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 = /export/home/oradata/orcl/users01.dbf
BLOCK = 17
 
Block 17 is corrupt
Corrupt block relative dba: 0x01000011 (file 0, block 17)
Fractured block found during verification
Data in bad block:
 type: 32 format: 2 rdba: 0x01000011
 last change scn: 0x0000.000735ed seq: 0x2 flg: 0x04
 spare1: 0x0 spare2: 0x0 spare3: 0x0
 consistency value in tail: 0x7bed2002
 check value in block header: 0x7f77
 computed block checksum: 0x6700
 
 
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

有1个块被标识为损坏,从刚才备份的那个文件覆盖它。
 
注意:filelist.txt 在file 中我们需要将我们的备份的数据文件也要加进去以后才能使用。
比如:
4 /export/home/oradata/orcl/users01.dbf       5242880
5 /export/home/oradata/orcl/users01.dbf.bak    5242880

BBED>  copy file 5 block 17 to file 4 block 17
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
 File: /export/home/oradata/orcl/users01.dbf (4)
 Block: 17               Offsets:    0 to  511           Dba:0x01000011
------------------------------------------------------------------------
 00a20000 11000000 00000000 00000105 11a70000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 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>

从刚才关闭数据库时cp的文件中复制第17个块来覆盖当前的块,覆盖完了再检查一下。
 
BBED> verify
DBVERIFY - Verification starting
FILE = /export/home/oradata/orcl/users01.dbf
BLOCK = 17
 
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            : 1
Total Blocks Marked Corrupt   : 0
Total Blocks Influx           : 0
 
BBED>

好了,看看123的情况
BBED>  dump file 4 block 17 offset 123
 File: /export/home/oradata/orcl/users01.dbf (4)
 Block: 17               Offsets:  123 to  634           Dba:0x01000011
------------------------------------------------------------------------
4bd68222 4b000000 00000000 00000000 00000000 00120000 01000000 00000000
 00080000 00080000 00190000 01000000 00000000 00000000 00050000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 000220ed 35
 
数据还原了过来,再次改过来,试试回滚的命令。
BBED> modify /x 62 file 4 block 17 offset 123
 File: /export/home/oradata/orcl/users01.dbf (4)
 Block: 17               Offsets:  123 to  634           Dba:0x01000011
------------------------------------------------------------------------
 62000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 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> undo
BBED> modify /x 00 filename '/export/home/oradata/orcl/users01.dbf' block 17. offset 123.
 File: /export/home/oradata/orcl/users01.dbf (4)
 Block: 17               Offsets:  123 to  634           Dba:0x01000011
------------------------------------------------------------------------
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 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>
 
undo就相当于sqlplus里面的 rollback 不过是回滚上一步,而不是所有操作。
 
下面试试revert,不过要重新登陆,因为revert是回滚这次登陆以来所有的操作。
BBED> dump file 4 block 17 offset 123
 File: /export/home/oradata/orcl/users01.dbf (4)
 Block: 17               Offsets:  120 to  631           Dba:0x01000011
------------------------------------------------------------------------
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 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> modify /x 62 file 4 block 17 offset 123
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
 File: /export/home/oradata/orcl/users01.dbf (4)
 Block: 17               Offsets:  123 to  634           Dba:0x01000011
------------------------------------------------------------------------
 62000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 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> revert
All changes made in this session will be rolled back. Proceed? (Y/N) y
Reverted file '/export/home/oradata/orcl/users01.dbf', block 17
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N)
 
BBED> dump file 4 block 17 offset 123
 File: /export/home/oradata/orcl/users01.dbf (4)
 Block: 17               Offsets:  123 to  634           Dba:0x01000011
------------------------------------------------------------------------
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 
 <32 bytes per line>

个人感觉bbed主要用在数据库恢复的时候,比如由于误操作把数据库的字典表的信息改错了,导致数据库不能启动了,此时用bbed在脱机的情况下把字典表的值再改回来。使数据库open。
 
用modify改完数据之后,block处于corrupt状态,所以要通过sum命令计算并应用checksum值,使block状态恢复正常。
 
测试:
SQL> select * from bl;
NAME
--------------------
dmm
l
SQL> select dump(1,1016) from dual;
 
DUMP(1,1016)
-----------------
Typ=2 Len=2: c1,2
BBED> dump file 4 block 17
 File: /export/home/oradata/orcl/users01.dbf (4)
 Block: 17               Offsets:    0 to  511           Dba:0x01000011
------------------------------------------------------------------------
 00a20000 11000000 00000000 00000105 11a70000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 
BBED>  modify /x 62 file 4 block 17 offset 0
 File: /export/home/oradata/orcl/users01.dbf (4)
 Block: 17               Offsets:    0 to  511           Dba:0x01000011
------------------------------------------------------------------------
 62a20000 11000000 00000000 00000105 11a70000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 
BBED> verify
DBVERIFY - Verification starting
FILE = /export/home/oradata/orcl/users01.dbf
BLOCK = 17
 
Block 17 is corrupt
Corrupt block relative dba: 0x00000011 (file 0, block 17)
Bad header found during verification
Data in bad block:
 type: 98 format: 2 rdba: 0x00000011
 last change scn: 0x0000.00000000 seq: 0x1 flg: 0x05
 spare1: 0x0 spare2: 0x0 spare3: 0x0
 consistency value in tail: 0x00000001
 check value in block header: 0xa711
 computed block checksum: 0x6262
 
 
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

修改完之后block的状态是corrupt的。用sum命令使之有效。
 
BBED> help sum
SUM [ DBA | FILE | FILENAME | BLOCK ] [ APPLY ]
 
BBED> sum file 4 block 17
Check value for File 4, Block 17:
current = 0xa711, required = 0xc573
此时 current checksum 是0xa711,required checksum 是0xc573
BBED> sum file 4 block 17 apply
Check value for File 4, Block 17:
current = 0xc573, required = 0xc573
加上apply参数,使checksum一致。此时block状态恢复正常。
 
BBED> verify
DBVERIFY - Verification starting
FILE = /export/home/oradata/orcl/users01.dbf
BLOCK = 17
 
Block 17 is corrupt
Corrupt block relative dba: 0x00000011 (file 0, block 17)
Bad header found during verification
Data in bad block:
 type: 98 format: 2 rdba: 0x00000011
 last change scn: 0x0000.00000000 seq: 0x1 flg: 0x05
 spare1: 0x0 spare2: 0x0 spare3: 0x0
 consistency value in tail: 0x00000001
 check value in block header: 0xc573
 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   : 0
Total Blocks Influx           : 0
 
重启一下数据库使之生效即可。
 
看看数据库的数据
SQL>select * from DAVE;
NAME
--------------------
dmm
l
 
这里也只是简单的介绍了下BBED 的使用,也是从网上找来的资料,还没有全部理解,有一片英文的文档不错,有空在好好研究一下,连接地址:

 
阅读(4403) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~