欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Oracle 11g下编译使用BBED的方法教程

程序员文章站 2022-04-03 20:29:22
bbed介绍: bbed(oracle block browerand editor tool),用来直接查看和修改数据文件数据的一个工具,是oracle一款内部工具,可...

bbed介绍:

bbed(oracle block browerand editor tool),用来直接查看和修改数据文件数据的一个工具,是oracle一款内部工具,可以直接修改oracle数据文件块的内容,在一些极端恢复场景下比较有用。该工具不受oracle支持,所以默认是没有生成可执行文件的,在使用前需要重新连接。

本文详细介绍了关于oracle 11g下编译使用bbed的方法教程,下面话不多说,来一起看看详细的介绍:

环境:rhel 6.4 + oracle 11.2.0.4

1. 拷贝缺失文件

11g中缺失几个相关文件,但我们实际可以从10g拷贝相关文件到11g对应目录下:

$oracle_home/rdbms/lib/sbbdpt.o
$oracle_home/rdbms/lib/ssbbded.o
$oracle_home/rdbms/mesg/bbedus.msb
$oracle_home/rdbms/mesg/bbedus.msg

2. 编译bbed

make -f $oracle_home/rdbms/lib/ins_rdbms.mk bbed=$oracle_home/bin/bbed $oracle_home/bin/bbed

成功编译的结果如下:

[oracle@jy-db01 dbhome_1]$ make -f $oracle_home/rdbms/lib/ins_rdbms.mk bbed=$oracle_home/bin/bbed $oracle_home/bin/bbed

linking bbed utility (bbed)
rm -f /u02/app/oracle/product/11.2.0/dbhome_1/bin/bbed
gcc -o /u02/app/oracle/product/11.2.0/dbhome_1/bin/bbed -m64 -z noexecstack -l/u02/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ -l/u02/app/oracle/product/11.2.0/dbhome_1/lib/ -l/u02/app/oracle/product/11.2.0/dbhome_1/lib/stubs/ /u02/app/oracle/product/11.2.0/dbhome_1/lib/s0main.o /u02/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ssbbded.o /u02/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/sbbdpt.o `cat /u02/app/oracle/product/11.2.0/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -ldbtools11 -lclntsh `cat /u02/app/oracle/product/11.2.0/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /u02/app/oracle/product/11.2.0/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lztkg11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lmm -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `cat /u02/app/oracle/product/11.2.0/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /u02/app/oracle/product/11.2.0/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `cat /u02/app/oracle/product/11.2.0/dbhome_1/lib/sysliblist` -wl,-rpath,/u02/app/oracle/product/11.2.0/dbhome_1/lib -lm `cat /u02/app/oracle/product/11.2.0/dbhome_1/lib/sysliblist` -ldl -lm -l/u02/app/oracle/product/11.2.0/dbhome_1/lib

3. bbed使用测试

--3.1 bbed命令测试可用
[oracle@jy-db01 dbhome_1]$ bbed
password: --密码默认是blockedit

bbed: release 2.0.0.0.0 - limited production on mon jan 18 15:13:09 2016

copyright (c) 1982, 2011, oracle and/or its affiliates. all rights reserved.

************* !!! for oracle internal use only !!! ***************

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> 

--3.2 bbed命令参数
[oracle@jy-db01 tmp]$ bbed help=y
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]

另外,一般使用bbed都是在参数配置文件中写好配置参数,然后直接调用配置文件,比如:

--编辑/tmp/bbed.par参数配置文件
blocksize=8192
listfile=/tmp/listfile.txt
mode=edit
--编辑/tmp/listfile.txt文件 
5 /u02/oradata/jingyu/dbs_d_jingyu01.dbf 31457280
6 /u02/oradata/jingyu/dbs_i_jingyu01.dbf 31457280
--调用bbed
cd /tmp
bbed parfile=bbed.par

reference

     •oracle bbed 工具 说明

     •

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对的支持。