1.bbed 简介
bbed (Block Browerand EDitor Tool):是oracle内存使用的一个工具,能直接查看和修改文件数据。但不受oracle支持,在一些复杂及极端的环境下使用。
对深入了解数据块结构能起到很好的帮助作用。
2.bbed安装过程
第一步:
oracle 11g中缺bbed包,oracle11g bbed install and example
上传(sbbdpt.o ssbbded.o bbedus.msb,该三个文件拷贝oracle的linux64版本的)文件
$ORACLE_HOME/rdbms/lib/ssbbded.o
$ORACLE_HOME/rdbms/lib/sbbdpt.o
$ORACLE_HOME/rdbms/mesg/bbedus.msb
第二步:
执行以下命令进行编译:
cd $ORACLE_HOME/rdbms/lib
make -f $ORACLE_HOME/rdbms/lib/ins_rdbms.mk BBED=$ORACLE_HOME/bin/bbed $ORACLE_HOME/bin/bbed
第三步:
BBED是Oracle 内部使用的命令,所以Oracle 不提供技术支持。 为了安全,BBED设置了口令保护,默认密码为blockedit。进入bbed
[[email protected] ~]$ bbed Password: BBED: Release 2.0.0.0.0 - Limited Production on Fri Nov 21 20:40:12 2014 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. ************* !!! For Oracle Internal Use only !!! *************** BBED>
第四步: 配置bbed默认环境
创建parameter file文件
[[email protected] tmp]$ vi bbedpar.txt 然后插入 blocksize=8192 listfile=/tmp/filelist.txt mode=edit
创建filelist.txt
执行select file#||chr(9)||name||chr(9)||bytes from v$datafile;
SQL> select file#||chr(9)||name||chr(9)||bytes from v$datafile; FILE#||CHR(9)||NAME||CHR(9)||BYTES -------------------------------------------------------------------------------- 1 /app/oracle/oradata/orcl/system01.dbf 754974720 2 /app/oracle/oradata/orcl/sysaux01.dbf 671088640 3 /app/oracle/oradata/orcl/undotbs01.dbf 99614720 4 /app/oracle/oradata/orcl/users01.dbf 716963840 5 /app/oracle/product/11g/db_1/dbs/D:OracleAdministratororadatayftestRES.DBF 524 288000 6 /tmp/user01.dbf 41943040 6 rows selected.
把查询的内容插入到filelist.txt中
第五步:
可以测试:
[[email protected] tmp]$ bbed parfile = /tmp/bbedpar.txt Password: BBED: Release 2.0.0.0.0 - Limited Production on Fri Nov 21 20:46:30 2014 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. ************* !!! For Oracle Internal Use only !!! *************** BBED>
成功
3.bbed命名
使用help all 查看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 ]
截取一些常用命令的说明
SET DBA [ dba | file#, block# ] -----设置(data block address file#+block#) SET FILENAME ‘filename‘ -----设置哪个文件的名称 SET FILE file# -----设置文件号 SET BLOCK [+/-]block# -----设置块号 SET OFFSET [ [+/-]byte offset | symbol | *symbol ] -----设置偏移量,字节为单位 SET BLOCKSIZE bytes -----设置块的大小(8192) SET LIST[FILE] ‘filename‘ -----设置文件列表 SET WIDTH character_count -----设置显示宽度 SET COUNT bytes_to_display -----设置显示的字节bytes数 SET IBASE [ HEX | OCT | DEC ] ---设置进制的模式 SET OBASE [ HEX | OCT | DEC ] ----- SET MODE [ BROWSE | EDIT ] ---设置操作模式,查看还是编辑 SET SPOOL [ Y | N ] -----是否保存操作日志
安装等都很简单,命令也很少,但使用时需要对oracle 数据块等很了解才能发挥出它的作用。
希望自己能好好加油!!