Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->数据库应用 ->Oracle ->正文

Oracle内部工具Block Corruption介绍

来源:赛迪网技术社区  作者:Webmaster 时间:2007-04-17 点击: [收藏] [投稿]

有人在Google新闻组上提出了一个问题:“How can I get the BBED password?”,继而引发了一场很有意思的讨论。

后来Pete Finnigan也在他的Blog写了一篇文章"An interesting thread on Oracle-l about BBED"描述这次有意思的探讨。

在讨论中,有一个有趣的观点提到,如果这个工具被广泛传播,那么可能有些人不是用BBED来修复数据,意外的破坏可能更为多见。最终的后果可能是Oracle彻底把这个工具移除。BBED是Block Browser/Editor的缩写,是Oracle的一个内部工具,不对外发布文档及支持。BBED随软件发布,但是我们需要进行简单的relink才能使用,relink请参考:How to compile Oracle10g BBED tools.

虽然BBED工具的使用存在很多风险,但是如果利用得当,可以以之解决很多棘手的问题。本文简单介绍一下怎么样用BBED模拟坏块,以练习坏块修复等技术,此前我曾经介绍过另外一种方法,请参考:Oracle中模拟及修复数据块损坏

1.创建测试表

[oracle@jumper conner]$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.4.0 - Production on Sun Sep 11 19:59:27 2005

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production

With the Partitioning option

JServer Release 9.2.0.4.0 - Production

SQL> create table bbed tablespace users as select * from dba_tables;

Table created.

SQL> select count(*) from bbed;

COUNT(*)

523

SQL> col segment_name for a10

SQL> select segment_name,file_id,block_id from 
dba_extents where segment_name='BBED';

SEGMENT_NA    FILE_ID   BLOCK_ID

---------- ---------- ----------

BBED                3          9

BBED                3         17

BBED                3         25

SQL> select count(*) from bbed;

COUNT(*)

523

2.创建BBED参数文件等。

[oracle@jumper conner]$ more filelist.txt

1 /opt/oracle/oradata/conner/system01.dbf   440401920

2 /opt/oracle/oradata/conner/undotbs01.dbf  104857600

3 /opt/oracle/oradata/conner/users01.dbf     27262976

[oracle@jumper conner]$ more par.bbd

blocksize=8192

listfile=filelist.txt

mode=edit

3.使用BBED

[oracle@jumper conner]$ bbed parfile=par.bbd

Password:

BBED: Release 2.0.0.0.0 - Limited Production on Sun Sep 11 20:01:01 2005

 Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

 ************* !!! For Oracle Internal Use only !!! ***************

 BBED> set file 3

        FILE#           3

 BBED> show

        FILE#           3

        BLOCK#          1

        OFFSET          0

        DBA             0x00c00001 (12582913 3,1)

        FILENAME        /opt/oracle/oradata/conner/users01.dbf

        BIFILE          bifile.bbd

        LISTFILE        filelist.txt

        BLOCKSIZE       8192

        MODE            Edit

        EDIT            Unrecoverable

        IBASE           Dec

        OBASE           Dec

        WIDTH           80

        COUNT           512

        LOGFILE         log.bbd

        SPOOL           No

4.回滚误操作

如果操作中发生误操作,可以使用revert命令回滚。



 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:Oracle数据库的完整性约束规则详解   下一篇:Oracle中安全可靠的复制问题的说明

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
BBED> modify /x 0x00c00011

 File: /opt/oracle/oradata/conner/users01.dbf (3)

 Block: 1                Offsets: 1000 to 1511           Dba:0x00c00001

------------------------------------------------------------------------

 00c00011 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

 

 <32 bytes per line>

 

BBED> revert

All changes made in this session will be rolled back. Proceed? (Y/N) Y

Reverted file '/opt/oracle/oradata/conner/users01.dbf', block 1

Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) Y