ITPub博客

首页 > 数据库 > Oracle > 使用BBED破坏数据(oracle11g)

使用BBED破坏数据(oracle11g)

原创 Oracle 作者:tolilong 时间:2012-06-10 10:03:53 0 删除 编辑
1.编辑BBED(11g不支持了,需要从10g copy过来)
Copy $ORA10g_HOME/rdbms/lib/ssbbded.o to $ORA11g_HOME/rdbms/lib
Copy $ORA10g_HOME/rdbms/lib/sbbdpt.o to $ORA11g_HOME/rdbms/lib

Message files (list may differ):
Copy $ORA10g_HOME/rdbms/mesg/bbedus.msb to $ORA11g_HOME/rdbms/mesg
Copy $ORA10g_HOME/rdbms/mesg/bbedus.msg to $ORA11g_HOME/rdbms/mesg
Copy $ORA10g_HOME/rdbms/mesg/bbedar.msb to $ORA11g_HOME/rdbms/mesg(这个不一定需要)

[oracle@deer ~]$ cd /u01/oracle/product/11.2.0/dbhome_1/rdbms/lib/
[oracle@deer lib]$ make -f ins_rdbms.mk /u01/oracle/product/11.2.0/dbhome_1/rdbms/lib/bbed
[oracle@deer lib]$ ll bbed
-rwxr-xr-x 1 oracle oinstall 262152 Jun 10 12:14 bbed


2.使用bbed
[oracle@rac10g2 lib]$ ./bbed
Password:    --->blockedit

BBED: Release 2.0.0.0.0 - Limited Production on Sun Jun 10 02:58:00 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

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

BBED>


3.create table test( id number(2),name varchar2(20))
    insert into test values(10,'bruce')
    insert into test values(20,'deer')
    select * from test
    select rowid,test.* from test
    select  dbms_rowid.rowid_relative_fno('AAAM8EAABAAAPCCAAA'),
                 dbms_rowid.rowid_block_number('AAAM8EAABAAAPCCAAA') from dual
    select  dbms_rowid.rowid_relative_fno('AAAM8EAABAAAPCCAAB'),
                 dbms_rowid.rowid_block_number('AAAM8EAABAAAPCCAAB') from dual
                 --查询file id,block id


4.创建bbed.par文件
   [oracle@deer lib]$ cat bbed.par
   blocksize=8192
   listfile=bbedlist
   mode=edit
  -----》其中bbedlist的内容为
  [oracle@deer lib]$ cat bbedlist
  1 /u01/oradata/deer/system01.dbf 7759462402
  2 /u01/oradata/deer/sysaux01.dbf 838860800


5.连接bbed
[oracle@deer lib]$ ./bbed parfile=bbed.par
Password:

BBED: Release 2.0.0.0.0 - Limited Production on Sun Jun 10 12:30:35 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

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

BBED>

BBED> set dba 1,91761
        DBA             0x00416671 (4286065 1,91761)

BBED> find /c bruce
 File: /u01/oradata/deer/system01.dbf (1)
 Block: 91761            Offsets: 8183 to 8191           Dba:0x00416671
------------------------------------------------------------------------
 62727563 650606b7 c6

 <32 bytes="" per="" line="">
------------------------------------------------------------------》打印出8183开始的内容,其中bruce就是要显示的内容。
BBED> dump /v dba 1,91761 offset 8183 count 32
 File: /u01/oradata/deer/system01.dbf (1)
 Block: 91761   Offsets: 8183 to 8191  Dba:0x00416671
-------------------------------------------------------
 62727563 650606b7 c6                l bruce..·?

 <16 bytes="" per="" line="">
---------------------------------------------------------------》破坏数据
BBED> modify 100 dba 1,91671
 File: /u01/oradata/deer/system01.dbf (1)
 Block: 91671            Offsets: 8183 to 8191           Dba:0x00416617
------------------------------------------------------------------------
 644e02c1 020106fa 90

 <32 bytes="" per="" line="">

退出


7.用DBV检查数据数据
[oracle@deer lib]$ dbv file=/u01/oradata/deer/system01.dbf

DBVERIFY: Release 11.2.0.1.0 - Production on Sun Jun 10 12:39:01 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

DBVERIFY - Verification starting : FILE = /u01/oradata/deer/system01.dbf
Page 91671 is marked corrupt
Corrupt block relative dba: 0x00416617 (file 1, block 91671)
Bad check value found during dbv:
Data in bad block:
 type: 6 format: 2 rdba: 0x00416617
 last change scn: 0x0000.009390fa seq: 0x1 flg: 0x04
 spare1: 0x0 spare2: 0x0 spare3: 0x0
 consistency value in tail: 0x90fa0601
 check value in block header: 0x276b
 computed block checksum: 0x6500



DBVERIFY - Verification complete

Total Pages Examined         : 94720
Total Pages Processed (Data) : 65631
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 12887
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 3418
Total Pages Processed (Seg)  : 1
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 12783
Total Pages Marked Corrupt   : 1
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 11463822 (0.11463822)

检查一个坏的数据块。


8.RMAN工具检查数据文件
RMAN> backup check logical validate database;

select * from v$database_block_corruption          ---显示结果

SQL> select * from test;
select * from test
              *
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 1, block # 91761)
ORA-01110: data file 1: '/u01/oradata/deer/system01.dbf'



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24237320/viewspace-732379/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-07-13

  • 博文量
    406
  • 访问量
    963998