合 Oracle异常恢复BBED系列
Tags: Oracle编译恢复BBEDORA-08102sys.bootstrap$
BBED(Oracle Block Browerand EDitor Tool),用来直接查看和修改数据文件数据的一个工具,是Oracle一款内部工具,可以直接修改Oracle数据文件块的内容,在一些极端恢复场景下比较有用。该工具不受Oracle支持,所以默认是没有生成可执行文件的,在使用前需要重新连接。
BBED编译及基本命令
前言部分
导读和注意事项
各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:
① BBED的安装(编译)
② BBED的基本命令
我的一个编译例子
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | oracle@ZTGXPADDB1:/oracle$ ls -l $ORACLE_HOME/rdbms/lib/*sbbd* -rw-r--r-- 1 oracle dba 1671 May 26 2010 /oracle/app/oracle/product/10.2.0/db/rdbms/lib/sbbdpt.o -rw-r--r-- 1 oracle dba 900 May 26 2010 /oracle/app/oracle/product/10.2.0/db/rdbms/lib/ssbbded.o oracle@ZTGXPADDB1:/oracle$ ls -l $ORACLE_HOME/rdbms/mesg/bbed* -rw-r--r-- 1 oracle dba 8704 May 27 2010 /oracle/app/oracle/product/10.2.0/db/rdbms/mesg/bbedus.msb -rw-r--r-- 1 oracle dba 10270 Jul 25 2000 /oracle/app/oracle/product/10.2.0/db/rdbms/mesg/bbedus.msg oracle@ZTGXPADDB1:/oracle$ oracle@ZTGXPADDB1:/oracle$ scp $ORACLE_HOME/rdbms/lib/*sbbd* oracle@22.188.194.64:/oracle/app/oracle/product/11.2.0/db/rdbms/lib/ The authenticity of host '22.188.194.64 (22.188.194.64)' can't be established. RSA key fingerprint is 17:0d:6f:34:a8:0b:15:20:ca:ab:35:83:58:bb:aa:4f. Are you sure you want to continue connecting (yes/no)?yes Warning: Permanently added '22.188.194.64' (RSA) to the list of known hosts. ************************************************************ * * * * * ATTENTION:You have logged onto a secured server. * * * * All accesses logged! * * * * * ************************************************************ oracle@22.188.194.64's password: sbbdpt.o 100% 1671 1.6KB/s 00:00 ssbbded.o 100% 900 0.9KB/s 00:00 oracle@ZTGXPADDB1:/oracle$ scp $ORACLE_HOME/rdbms/mesg/bbed* oracle@22.188.194.64:/oracle/app/oracle/product/11.2.0/db/rdbms/mesg/ ************************************************************ * * * * * ATTENTION:You have logged onto a secured server. * * * * All accesses logged! * * * * * ************************************************************ oracle@22.188.194.64's password: bbedus.msb 100% 8704 8.5KB/s 00:00 bbedus.msg 100% 10KB 10.0KB/s 00:00 oracle@ZTGXPADDB1:/oracle$ [oracle@ZFFR4CB1101:/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib]$ cd $ORACLE_HOME/rdbms/lib [oracle@ZFFR4CB1101:/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib]$ make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed Linking BBED utility (bbed) rm -f /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/bbed ld -b64 -o /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/bbed -L/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ -L/u01/app/oracle/product/11.2.0/dbhome_1/lib/ /u01/app/oracle/product/11.2.0/dbhome_1/lib/s0main.o /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ssbbded.o /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/sbbdpt.o -bI:/usr/lib/aio.exp `cat /u01/app/oracle/product/11.2.0/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -ldbtools11 `cat /u01/app/oracle/product/11.2.0/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /u01/app/oracle/product/11.2.0/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lztkg11 -lztkg11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lmm -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `cat /u01/app/oracle/product/11.2.0/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /u01/app/oracle/product/11.2.0/dbhome_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lpls11 -lrt -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 -lld -lm `cat /u01/app/oracle/product/11.2.0/dbhome_1/lib/sysliblist` -lm -lsql11 /u01/app/oracle/product/11.2.0/dbhome_1/lib/nautab.o /u01/app/oracle/product/11.2.0/dbhome_1/lib/naeet.o /u01/app/oracle/product/11.2.0/dbhome_1/lib/naect.o /u01/app/oracle/product/11.2.0/dbhome_1/lib/naedhs.o ld: 0711-224 WARNING: Duplicate symbol: .aio_nwait_timeout64 ld: 0711-224 WARNING: Duplicate symbol: aio_nwait_timeout64 ld: 0711-224 WARNING: Duplicate symbol: .aio_nwait64 ld: 0711-224 WARNING: Duplicate symbol: aio_nwait64 ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. ld: 0711-773 WARNING: Object /u01/app/oracle/product/11.2.0/dbhome_1/lib//libgeneric11.a[sdbgrfu.o], imported symbol timezone Symbol was expected to be local. Extra instructions are being generated to reference the symbol. [oracle@ZFFR4CB1101:/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib]$ [oracle@ZFFR4CB1101:/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib]$ bbed Password: BBED: Release 2.0.0.0.0 - Limited Production on Wed Mar 23 11:12:18 2016 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. ************* !!! For Oracle Internal Use only !!! *************** BBED> |
我的命令
1 2 3 4 5 6 7 8 9 10 | ls -l $ORACLE_HOME/rdbms/lib/*sbbd* ls -l $ORACLE_HOME/rdbms/mesg/bbed* chown oracle:dba /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/*sbbd* chown oracle:dba /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/mesg/bbed* --cd $ORACLE_HOME/rdbms/lib --make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed --make -f $ORACLE_HOME/rdbms/lib/ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed make -f $ORACLE_HOME/rdbms/lib/ins_rdbms.mk BBED=$ORACLE_HOME/bin/bbed $ORACLE_HOME/bin/bbed |
总结
11g以下可以直接编译使用,11g及以后需要从相应平台的10g中拷贝4个文件到11g相应目录,如下,bbedar.msb可以不用拷贝。然后执行编译命令即可,编译的bbed命令可以直接生成在$ORACLE_HOME/bin下,命令为:make -f $ORACLE_HOME/rdbms/lib/ins_rdbms.mk BBED=$ORACLE_HOME/bin/bbed $ORACLE_HOME/bin/bbed
1 2 3 4 5 | $ORACLE_HOME/rdbms/lib/ssbbded.o $ORACLE_HOME/rdbms/lib/sbbdpt.o $ORACLE_HOME/rdbms/mesg/bbedus.msb $ORACLE_HOME/rdbms/mesg/bbedus.msg $ORACLE_HOME/rdbms/mesg/bbedar.msb |
我的使用代码
1 2 3 4 5 6 7 8 9 10 11 12 | vi /home/oracle/file.txt set line 9999 pagesize 9999 col name format a80 select file#||' '||name||' '||bytes name from v$datafile; vi /home/oracle/bbed.par blocksize=8192 listfile=/home/oracle/file.txt mode=edit bbed parfile=/home/oracle/bbed.par bbed PASSWORD=blockedit mode=edit blocksize=8192 listfile=/home/oracle/file.txt |
注意事项
① 若使用bbed的过程中,数据库有重启的过程,最好是退出BBED重新进入bbed的环境
② windows下BBED软件和其他系统下BBED不太一样,操作的时候块号比其他系统下多一个
bbed日志记录 log.bbd
bbed启动和运行的过程会将运行过的所有命令记录到当前的目录下log.bbd文件中,所以bbed要求oracle用户在当前目录具有创建文件的权限。
报错BBED-00303: unable to open file 'log.bbd'
oracle用户需要对当前操作目录有权限,否则报错:
BBED-00303: unable to open file 'log.bbd'
ZFZHLHRDB2:oracle:/oracle>touch log.bbd
touch: 0652-046 Cannot create log.bbd.
ZFZHLHRDB2:oracle:/oracle>ls -ld
drwxr-xr-x 5 root dba 256 Mar 14 15:41 .