Oracle8i 的BBED在windows 平台下的$ORACLE_HOME/bin下可以找到
ORACLE9i数据库就自带bbed程序,就在%ORACLE_HOME%/bin目录下,在linux上面也有,需要自己编译。
9i/10g bbed:
cd $ORACLE_HOME/rdbms/lib ls -al *bb* make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed mv bbed $ORACLE_HOME/bin
11g和12.1需要10g的5个文件(bbedzhs.msb是可选的):
/rdbms/mesg/bbed* bbedus.msb bbedus.msg bbedzhs.msb cp /tmp/lunar/ssbbded.o $ORACLE_HOME/rdbms/lib/ cp /tmp/lunar/sbbdpt.o $ORACLE_HOME/rdbms/lib/ cp /tmp/lunar/bbedus.msg $ORACLE_HOME/rdbms/mesg/ cp /tmp/lunar/bbedus.msb $ORACLE_HOME/rdbms/mesg/ cd $ORACLE_HOME/rdbms/lib ls -al *bb* make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed mv bbed $ORACLE_HOME/bin
BBED的缺省口令是 blockedit:
[oracle@lunar ~]$ bbed Password: blockedit(默认该密码) BBED: Release 2.0.0.0.0 - Limited Production on Thu Jan 17 18:32:16 2013 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. ************* !!! For Oracle Internal Use only !!! *************** BBED>
一般使用bbed,都是将一些配置信息写入到一个参数文本里,在调用bbed时,指定该参数文件。如:
先从v$datafile中获取file#,name,bytes,然后组成filelist.lst
cat /tmp/lunar/filelist.lst 1 /u01/app/oracle/oradata/dave2/system01.dbf 1761607680 cat /tmp/lunar/bbed.par blocksize=8192 listfile=/tmp/lunar/filelist.lst mode=edit password=blockedit spool=yes [oracle@lunar ~]$bbed parfile=bbed.par BBED: Release 2.0.0.0.0 - Limited Production on Thu Jan 17 18:32:16 2013 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. ************* !!! For Oracle Internal Use only !!! *************** BBED>
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
可以使用help来查看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 [ <SET parameter> | 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 ] </Nuf>: 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] <target spec>=<source spec> <target spec> : [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ] <source spec> : [ value | <target spec options> ] SUM [ DBA | FILE | FILENAME | BLOCK ] [ APPLY ] PUSH [ DBA | FILE | FILENAME | BLOCK | OFFSET ] POP [ALL] REVERT [ DBA | FILE | FILENAME | BLOCK ] UNDO HELP [ <bbed command> | ALL ] VERIFY [ DBA | FILE | FILENAME | BLOCK ] CORRUPT [ DBA | FILE | FILENAME | BLOCK ] BBED>