查看: 1688|回复: 0

[Oracle数据库] Oracle 11g下编译使用BBED的方法教程

发表于 2017-10-10 08:00:04
句号论坛

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对应目录下:

  1. $ORACLE_HOME/rdbms/lib/sbbdpt.o
  2. $ORACLE_HOME/rdbms/lib/ssbbded.o
  3. $ORACLE_HOME/rdbms/mesg/bbedus.msb
  4. $ORACLE_HOME/rdbms/mesg/bbedus.msg
复制代码

2. 编译BBED

  1. make -f $ORACLE_HOME/rdbms/lib/ins_rdbms.mk BBED=$ORACLE_HOME/bin/bbed $ORACLE_HOME/bin/bbed
复制代码

成功编译的结果如下:

  1. [oracle@JY-DB01 dbhome_1]$ make -f $ORACLE_HOME/rdbms/lib/ins_rdbms.mk BBED=$ORACLE_HOME/bin/bbed $ORACLE_HOME/bin/bbed
  2. Linking BBED utility (bbed)
  3. rm -f /u02/app/oracle/product/11.2.0/dbhome_1/bin/bbed
  4. 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使用测试

  1. --3.1 bbed命令测试可用
  2. [oracle@JY-DB01 dbhome_1]$ bbed
  3. Password: --密码默认是blockedit
  4. BBED: Release 2.0.0.0.0 - Limited Production on Mon Jan 18 15:13:09 2016
  5. Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
  6. ************* !!! For Oracle Internal Use only !!! ***************
  7. BBED> help all
  8. SET DBA [ dba | file#, block# ]
  9. SET FILENAME 'filename'
  10. SET FILE file#
  11. SET BLOCK [+/-]block#
  12. SET OFFSET [ [+/-]byte offset | symbol | *symbol ]
  13. SET BLOCKSIZE bytes
  14. SET LIST[FILE] 'filename'
  15. SET WIDTH character_count
  16. SET COUNT bytes_to_display
  17. SET IBASE [ HEX | OCT | DEC ]
  18. SET OBASE [ HEX | OCT | DEC ]
  19. SET MODE [ BROWSE | EDIT ]
  20. SET SPOOL [ Y | N ]
  21. SHOW [ <SET parameter> | ALL ]
  22. INFO
  23. MAP[/v] [ DBA | FILENAME | FILE | BLOCK ]
  24. DUMP[/v] [ DBA | FILENAME | FILE | BLOCK | OFFSET | COUNT ]
  25. PRINT[/x|d|u|o|c] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
  26. EXAMINE[/Nuf] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
  27. </Nuf>:
  28. N - a number which specifies a repeat count.
  29. u - a letter which specifies a unit size:
  30. b - b1, ub1 (byte)
  31. h - b2, ub2 (half-word)
  32. w - b4, ub4(word)
  33. r - Oracle table/index row
  34. f - a letter which specifies a display format:
  35. x - hexadecimal
  36. d - decimal
  37. u - unsigned decimal
  38. o - octal
  39. c - character (native)
  40. n - Oracle number
  41. t - Oracle date
  42. i - Oracle rowid
  43. FIND[/x|d|u|o|c] numeric/character string [ TOP | CURR ]
  44. COPY [ DBA | FILE | FILENAME | BLOCK ] TO [ DBA | FILE | FILENAME | BLOCK ]
  45. MODIFY[/x|d|u|o|c] numeric/character string
  46. [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
  47. ASSIGN[/x|d|u|o] <target spec>=<source spec>
  48. <target spec> : [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
  49. <source spec> : [ value | <target spec options> ]
  50. SUM [ DBA | FILE | FILENAME | BLOCK ] [ APPLY ]
  51. PUSH [ DBA | FILE | FILENAME | BLOCK | OFFSET ]
  52. POP [ALL]
  53. REVERT [ DBA | FILE | FILENAME | BLOCK ]
  54. UNDO
  55. HELP [ <bbed command> | ALL ]
  56. VERIFY [ DBA | FILE | FILENAME | BLOCK ]
  57. CORRUPT [ DBA | FILE | FILENAME | BLOCK ]
  58. BBED>
  59. --3.2 bbed命令参数
  60. [oracle@JY-DB01 tmp]$ bbed help=y
  61. PASSWORD - Required parameter
  62. FILENAME - Database file name
  63. BLOCKSIZE - Database block size
  64. LISTFILE - List file name
  65. MODE - [browse/edit]
  66. SPOOL - Spool to logfile [no/yes]
  67. CMDFILE - BBED command file name
  68. LOGFILE - BBED log file name
  69. PARFILE - Parameter file name
  70. BIFILE - BBED before-image file name
  71. REVERT - Rollback changes from BIFILE [no/yes]
  72. SILENT - Hide banner [no/yes]
  73. HELP - Show all valid parameters [no/yes]
复制代码

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

  1. --编辑/tmp/bbed.par参数配置文件
  2. blocksize=8192
  3. listfile=/tmp/listfile.txt
  4. mode=edit
  5. --编辑/tmp/listfile.txt文件
  6. 5 /u02/oradata/jingyu/dbs_d_jingyu01.dbf 31457280
  7. 6 /u02/oradata/jingyu/dbs_i_jingyu01.dbf 31457280
  8. --调用bbed
  9. cd /tmp
  10. bbed parfile=bbed.par
复制代码

Reference

?Oracle BBED 工具 说明

?四步快速启动oracle bbed

总结

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



太阳http代理AD
回复

使用道具 举报

关闭

站长推荐上一条 /1 下一条