BBED介紹:
BBED(Oracle Block Browerand EDitor Tool),用來(lái)直接查看和修改數(shù)據(jù)文件數(shù)據(jù)的一個(gè)工具,是Oracle一款內(nèi)部工具,可以直接修改Oracle數(shù)據(jù)文件塊的內(nèi)容,在一些極端恢復(fù)場(chǎng)景下比較有用。該工具不受Oracle支持,所以默認(rèn)是沒有生成可執(zhí)行文件的,在使用前需要重新連接。
本文詳細(xì)介紹了關(guān)于Oracle 11g下編譯使用BBED的方法教程,下面話不多說(shuō),來(lái)一起看看詳細(xì)的介紹:
環(huán)境:RHEL 6.4 + Oracle 11.2.0.4
1. 拷貝缺失文件
11g中缺失幾個(gè)相關(guān)文件,但我們實(shí)際可以從10g拷貝相關(guān)文件到11g對(duì)應(yīng)目錄下:
$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
成功編譯的結(jié)果如下:
[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使用測(cè)試
--3.1 bbed命令測(cè)試可用
[oracle@JY-DB01 dbhome_1]$ bbed
Password: --密碼默認(rèn)是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命令參數(shù)
[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都是在參數(shù)配置文件中寫好配置參數(shù),然后直接調(diào)用配置文件,比如:
--編輯/tmp/bbed.par參數(shù)配置文件
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
--調(diào)用bbed
cd /tmp
bbed parfile=bbed.par
Reference
•Oracle BBED 工具 說(shuō)明
•四步快速啟動(dòng)oracle bbed
總結(jié)
以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作能帶來(lái)一定的幫助,如果有疑問大家可以留言交流,謝謝大家對(duì)腳本之家的支持。
您可能感興趣的文章:- oracle bbed恢復(fù)刪除數(shù)據(jù)實(shí)例