使用BBED破壞資料(oracle11g)

tolilong發表於2012-06-10
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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章