先看幫助的說明 BBED> help all SET DBA [ dba | file#, block# ] SET FILENAME 'filename' SET FILE file# SET BLOCK [+/-]block# SET OFFSET [ [+/-]byte offset | symbol | *symbol ] SET BLOCKSIZE bytes SET LIST[FILE] 'filename' SET WIDTH character_count SET COUNT bytes_to_display SET IBASE [ HEX | OCT | DEC ] SET OBASE [ HEX | OCT | DEC ] SET MODE [ BROWSE | EDIT ] SET SPOOL [ Y | N ] SHOW [ <SET parameter> | ALL ] INFO MAP[/v] [ DBA | FILENAME | FILE | BLOCK ] DUMP[/v] [ DBA | FILENAME | FILE | BLOCK | OFFSET | COUNT ] PRINT[/x|d|u|o|c] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ] EXAMINE[/Nuf] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ] </Nuf>: N - a number which specifies a repeat count. u - a letter which specifies a unit size: b - b1, ub1 (byte) h - b2, ub2 (half-word) w - b4, ub4(word) r - Oracle table/index row f - a letter which specifies a display format: x - hexadecimal d - decimal u - unsigned decimal o - octal c - character (native) n - Oracle number t - Oracle date i - Oracle rowid FIND[/x|d|u|o|c] numeric/character string [ TOP | CURR ] COPY [ DBA | FILE | FILENAME | BLOCK ] TO [ DBA | FILE | FILENAME | BLOCK ] MODIFY[/x|d|u|o|c] numeric/character string [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ] ASSIGN[/x|d|u|o] <target spec>=<source spec> <target spec> : [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ] <source spec> : [ value | <target spec options> ] SUM [ DBA | FILE | FILENAME | BLOCK ] [ APPLY ] PUSH [ DBA | FILE | FILENAME | BLOCK | OFFSET ] POP [ALL] REVERT [ DBA | FILE | FILENAME | BLOCK ] UNDO HELP [ <bbed command> | ALL ] VERIFY [ DBA | FILE | FILENAME | BLOCK ] CORRUPT [ DBA | FILE | FILENAME | BLOCK ] BBED> set 設定當前的環境 show 查看當前的環境參數,跟sqlplus的同名命令相似。 dump 列出指定block的內容 find 在指定的block中查找指定的字符串,結果是顯示出字符串,及其偏移量--offset,偏移量就是在block中的字節數 modify 修改指定block的指定偏移量的值,能夠在線修改。 copy 把一個block的內容copy到另外一個block中 verify 檢查當前環境是否有壞塊 sum 計算block的checksum,modify以後block就被標識爲壞塊,current checksum與reqired checksum不一致,sum命令能夠計算出新的checksum並應用到當前塊。 undo 回滾當前的修改操做,若是手誤作錯了,undo一下就ok了,回到原來的狀態。 revert 回滾全部以前的修改操做,意思就是 undo all
--顯示當前能夠進行browse或者edit 的file。即咱們filelist( /u01/app/oracle/bbed/filelist.txt )裏指定的datafile信息。html
BBED> info
File# Name Size(blks)
----- ---- ----------
1 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_bc7ld3s 61440
2 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_bc7ld 40320
3 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_bc7lf4b 30720
4 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_bc7lflno 640
BBED>
顯示當前的配置選項,注意當前文件及數據塊sql
BBED> show
FILE# 3
BLOCK# 12
OFFSET 0
DBA 0x00c0000c (12582924 3,12)
FILENAME /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_bc7lf4bd_.dbf
BIFILE bifile.bbd
LISTFILE /u01/app/oracle/bbed/filelist.txt
BLOCKSIZE 8192
MODE Edit
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 80
COUNT 512
LOGFILE log.bbd
SPOOL No
BBED>
1.3.1 set file :根據文件號設置當前文件數據庫
BBED> set file 2
FILE# 2
BBED> show
FILE# 2 --當前文件
BLOCK# 12
OFFSET 0
DBA 0x0080000c (8388620 2,12)
FILENAME /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_bc7ldql4_.dbf
BIFILE bifile.bbd
LISTFILE /u01/app/oracle/bbed/filelist.txt
BLOCKSIZE 8192
MODE Edit
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 80
COUNT 512
LOGFILE log.bbd
SPOOL No
BBED>
1.3.2 set block :指定當前文件中的塊緩存
BBED> set block 100
BLOCK# 100
BBED> show
FILE# 2
BLOCK# 100
OFFSET 0
DBA 0x00800064 (8388708 2,100)
FILENAME /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_bc7ldql4_.dbf
BIFILE bifile.bbd
LISTFILE /u01/app/oracle/bbed/filelist.txt
BLOCKSIZE 8192
MODE Edit
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 80
COUNT 512
LOGFILE log.bbd
SPOOL No
BBED> set block +10
BLOCK# 110
BBED>
1.3.3 set width :設定當前屏幕的寬度,默認是80.網絡
BBED> set width 100
WIDTH 100
BBED>
3.3.4 set mode :設置bbed 的模式browse 或 edit。 browse 模式不容許進行修改。 若是要修改,就選擇edit模式。這個在以前的配置文件bbed.par裏,選擇了edit。oracle
BBED> set mode browse
MODE Browse
BBED> set mode edit
MODE Edit
BBED>
--Map會經過偏移量來顯示block裏的詳細信息,如block header,data block header 和row directory。 使用/v 選項,能夠查看更詳細的信息。app
--在不指定block的狀況下,會顯示當前block的信息,若是想顯示其餘block的信息,可使用file name,file id,block 和DBA 來指定要顯示的block。ui
BBED> map --只顯示當前塊的部分信息
File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5)
Block: 3252 Dba:0x01400cb4
------------------------------------------------------------
KTB Data Block (Table/Cluster)
struct kcbh, 20 bytes @0 --block header 信息
struct ktbbh, 72 bytes @20 --事務信息
struct kdbh, 14 bytes @100 --對應尾區部分
struct kdbt[1], 4 bytes @114 --table directory *kdbt[0]指針顯示值
sb2 kdbr[333] @118 --row directory *kdbr[0]指針值顯示狀態flg
ub1 freespace[4739] @784 --free space
ub1 rowdata[2665] @5523 --row data (採用倒序排列,第一行在最下面)
ub4 tailchk @8188 --tail check
BBED>
BBED> map /v -顯示當前塊的詳細信息
File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5)
Block: 3252 Dba:0x01400cb4
------------------------------------------------------------
KTB Data Block (Table/Cluster)
struct kcbh, 20 bytes @0
ub1 type_kcbh @0
ub1 frmt_kcbh @1
ub1 spare1_kcbh @2
ub1 spare2_kcbh @3
ub4 rdba_kcbh @4
ub4 bas_kcbh @8
ub2 wrp_kcbh @12
ub1 seq_kcbh @14
ub1 flg_kcbh @15
ub2 chkval_kcbh @16
ub2 spare3_kcbh @18
struct ktbbh, 72 bytes @20
ub1 ktbbhtyp @20
union ktbbhsid, 4 bytes @24
struct ktbbhcsc, 8 bytes @28
b2 ktbbhict @36
ub1 ktbbhflg @38
ub1 ktbbhfsl @39
ub4 ktbbhfnx @40
struct ktbbhitl[2], 48 bytes @44
struct kdbh, 14 bytes @100
ub1 kdbhflag @100
b1 kdbhntab @101
b2 kdbhnrow @102
sb2 kdbhfrre @104
sb2 kdbhfsbo @106
sb2 kdbhfseo @108
b2 kdbhavsp @110
b2 kdbhtosp @112
struct kdbt[1], 4 bytes @114
b2 kdbtoffs @114
b2 kdbtnrow @116
sb2 kdbr[333] @118
ub1 freespace[4739] @784
ub1 rowdata[2665] @5523
ub4 tailchk @8188
BBED>
Map 顯示的具體信息解釋以下:this
|
map命令只輸出數據塊的結構信息,print命令輸出的信息比map更加詳細。
print其輸出格式:UnitSize* | Name | Offset| Value -------自定義類型|名稱|塊內偏移量|值
示例:
--利用map輸出數據塊結構
BBED> set file 5
FILE# 5
BBED> set block 3252
BLOCK# 3252
BBED> map /v
File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5)
Block: 3252 Dba:0x01400cb4
------------------------------------------------------------
KTB Data Block (Table/Cluster)
struct kcbh, 20 bytes @0
ub1 type_kcbh @0
ub1 frmt_kcbh @1
ub1 spare1_kcbh @2
ub1 spare2_kcbh @3
ub4 rdba_kcbh @4
ub4 bas_kcbh @8
ub2 wrp_kcbh @12
ub1 seq_kcbh @14
ub1 flg_kcbh @15
ub2 chkval_kcbh @16
ub2 spare3_kcbh @18
struct ktbbh, 72 bytes @20
ub1 ktbbhtyp @20
union ktbbhsid, 4 bytes @24
struct ktbbhcsc, 8 bytes @28
b2 ktbbhict @36
ub1 ktbbhflg @38
ub1 ktbbhfsl @39
ub4 ktbbhfnx @40
struct ktbbhitl[2], 48 bytes @44
struct kdbh, 14 bytes @100
ub1 kdbhflag @100
b1 kdbhntab @101
b2 kdbhnrow @102
sb2 kdbhfrre @104
sb2 kdbhfsbo @106
sb2 kdbhfseo @108
b2 kdbhavsp @110
b2 kdbhtosp @112
struct kdbt[1], 4 bytes @114
b2 kdbtoffs @114
b2 kdbtnrow @116
sb2 kdbr[333] @118
ub1 freespace[4739] @784
ub1 rowdata[2665] @5523
ub4 tailchk @8188
--利用print輸出ktbbh結構中的元素信息
BBED> print ktbbh
struct ktbbh, 72 bytes @20
ub1 ktbbhtyp @20 0x01 (KDDBTDATA)
union ktbbhsid, 4 bytes @24
ub4 ktbbhsg1 @24 0x0000c7d1
ub4 ktbbhod1 @24 0x0000c7d1
struct ktbbhcsc, 8 bytes @28
ub4 kscnbas @28 0x0005f8f9
ub2 kscnwrp @32 0x0000
b2 ktbbhict @36 2
ub1 ktbbhflg @38 0x32 (NONE)
ub1 ktbbhfsl @39 0x00
ub4 ktbbhfnx @40 0x01400c89
struct ktbbhitl[0], 24 bytes @44
struct ktbitxid, 8 bytes @44
ub2 kxidusn @44 0x0002
ub2 kxidslt @46 0x0019
ub4 kxidsqn @48 0x000000f5
struct ktbituba, 8 bytes @52
ub4 kubadba @52 0x00804a72
ub2 kubaseq @56 0x0082
ub1 kubarec @58 0x0b
ub2 ktbitflg @60 0xa000 (KTBFUPB, KTBFCOM)
union _ktbitun, 2 bytes @62
b2 _ktbitfsc @62 0
ub2 _ktbitwrp @62 0x0000
ub4 ktbitbas @64 0x0005f1dd
struct ktbbhitl[1], 24 bytes @68
struct ktbitxid, 8 bytes @68
ub2 kxidusn @68 0x0002
ub2 kxidslt @70 0x0022
ub4 kxidsqn @72 0x000000f8
struct ktbituba, 8 bytes @76
ub4 kubadba @76 0x008090ac
ub2 kubaseq @80 0x0085
ub1 kubarec @82 0x1f
ub2 ktbitflg @84 0x2001 (KTBFUPB)
union _ktbitun, 2 bytes @86
b2 _ktbitfsc @86 0
ub2 _ktbitwrp @86 0x0000
ub4 ktbitbas @88 0x000600bc
---輸出其葉子節點信息
BBED> print ktbbh.ktbbhitl[0].ktbitxid.kxidusn
ub2 kxidusn @44 0x0002
BBED>
---dump命令能夠講block 的內容顯示到屏幕。每次顯示的bytes由count 控制,默認是512 bytes。使用 /v 選項,能夠顯示更多詳細信息
BBED> dump /v dba 2,111 offset 0 count 128 File: /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_bc7ldql4_.dbf (2) Block: 111 Offsets: 0 to 127 Dba:0x0080006f ------------------------------------------------------- 02a20000 6f008000 b6260400 00005d04 l ..o.......]. 38e80000 07002700 ae000000 48005c5c l 8...'...H.\\ 0000e81f 741f301f d01e8c1e 281ee41d l ..t.0...(. 801d1c1d d81c781c 341cd01b 8c1b281b l ....x.4...(. c41a801a 201adc19 78193419 d0186c18 l .. .x.4.l. 2818c817 84172017 dc167816 1416d015 l (... .x... 70152c15 c8148414 2014bc13 78131813 l p.,... .x... d4127012 2c12c811 64112011 b8105410 l p.,.d. .T. <16 bytes per line> BBED>
---能夠用來搜索關鍵字。 能夠從offset 0 搜索到top 或者從當前的offset 搜索到top
---find 命令支持的switch 類型以下表,注意,find 不支持number和Date
Switch |
Datatype |
/x |
Hexadecimal |
/d |
Decimal |
/u |
unsigned decimal |
/o |
Octal |
/c |
character (native) |
--查找文件及數據塊編號 SQL> select 2 rowid, 3 dbms_rowid.rowid_relative_fno(rowid) REL_FNO,--File id 數據庫文件數少於1024時,REL_FNO與File id相同 4 dbms_rowid.rowid_block_number(rowid) BLOCK_NO,--Block number 5 dbms_rowid.rowid_row_number(rowid) ROW_NO 6 from tv.t01 7 where name='zz'; ROWID REL_FNO BLOCK_NO ROW_NO ------------------ ---------- ---------- ---------- AAAMfRAAFAAAAy0AFM 5 3252 332 SQL> --設置當前文件及數據塊 BBED> set file 5 FILE# 5 BBED> set block 3252 BLOCK# 3252 BBED> show FILE# 5 BLOCK# 3252 OFFSET 0 DBA 0x01400cb4 (20974772 5,3252) ----0x01400cb4爲rdba;0x01400cb4的十進制 20974772 FILENAME /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf BIFILE bifile.bbd LISTFILE /u01/app/oracle/bbed/filelist.txt BLOCKSIZE 8192 MODE Edit EDIT Unrecoverable IBASE Dec OBASE Dec WIDTH 80 COUNT 512 LOGFILE log.bbd SPOOL No BBED> find /c zz top --前面已經指定數據文件5和數據塊3252 File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5) Block: 3252 Offsets: 5530 to 6041 Dba:0x01400cb4 --rdba ------------------------------------------------------------------------ 7a7a2c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 <32 bytes per line> BBED> BBED> dump /v offset 5530 count 128 --前面已經指定數據文件5和數據塊3252 File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5) Block: 3252 Offsets: 5530 to 5657 Dba:0x01400cb4 ------------------------------------------------------- 7a7a2c00 02018002 79792c00 02018002 l zz,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... <16 bytes per line> BBED> --結果顯示的頭兩個字母就是zz --若是咱們要繼續搜索zz,那麼只須要按下f 就能夠了,不須要跟參數。 BBED> f BBED-00212: search string not found --咱們的塊裏只有一個'zz' BBED>
---用於改變塊內的數據
---在file 5,block 3252 有'zz',咱們這裏把zz 改爲ww。
BBED> set file 5 FILE# 5 BBED> set block 3252 BLOCK# 3252 BBED> show FILE# 5 BLOCK# 3252 OFFSET 0 DBA 0x01400cb4 (20974772 5,3252) FILENAME /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf BIFILE bifile.bbd LISTFILE /u01/app/oracle/bbed/filelist.txt BLOCKSIZE 8192 MODE Edit EDIT Unrecoverable IBASE Dec OBASE Dec WIDTH 80 COUNT 512 LOGFILE log.bbd SPOOL No --更改前的數據 BBED> dump /v offset 5530 count 128 File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5) Block: 3252 Offsets: 5530 to 5657 Dba:0x01400cb4 ------------------------------------------------------- 7a7a2c00 02018002 79792c00 02018002 l zz,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... <16 bytes per line> --開始更改 BBED> modify /c ww offset 5530 File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5) Block: 3252 Offsets: 5530 to 5657 Dba:0x01400cb4 ------------------------------------------------------------------------ 77772c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 <32 bytes per line> --查看更改後的 BBED> dump /v offset 5530 count 128 File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5) Block: 3252 Offsets: 5530 to 5657 Dba:0x01400cb4 ------------------------------------------------------- 77772c00 02018002 79792c00 02018002 l ww,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... <16 bytes per line> BBED>
接下來使改變的值生效的命令sum
BBED> sum dba 5,3252 apply
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
Check value for File 5, Block 3252:
current = 0x5a3f, required = 0x5a3f
BBED>
--回到sql窗口,刷新緩存
SQL> alter system set events = 'immediate trace name flush_cache';
或
SQL> alter system flush buffer_cache;
--查詢
SQL> select * from tv.t01 where name='ww';
ID NAME
-- ----------
1 ww
SQL>
注:下面對這些數據用SQL語句作相互轉換
1)把表中的數據轉成16進制(即在ORACLE內部數據塊看到的數據),用如下sql語句:
SQL> select dump('ww','16')
2 from dual;
DUMP('WW','16')
-------------------
Typ=96 Len=2: 77,77 --7777爲'ww'的16進制值
SQL>
2)反過來把16進制轉成表中的數據(固然我這邊的數據類型只考慮了number和varchar類型),用以sql下語句:
SQL> col id for 9 ---對number類型格式化。若是寫成col id for a9,查詢出的值爲亂碼(##########)
SQL> col name for a10
SQL> select
2 UTL_RAW.CAST_TO_NUMBER(replace('c102',' ')) id,
3 UTL_RAW.CAST_TO_VARCHAR2(replace('77772c00',' ')) name
4 from dual;
ID NAME
-- ----------
1 ww,
SQL>
--revert是恢復自bbed 啓動以來的全部修改(包含被sum apply的數據)
--將'ww'改爲'zz' BBED> modify /c zz offset 5530 File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5) Block: 3252 Offsets: 5530 to 5657 Dba:0x01400cb4 ------------------------------------------------------------------------ 7a7a2c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 <32 bytes per line> --查看 BBED> dump /v offset 5530 count 128 File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5) Block: 3252 Offsets: 5530 to 5657 Dba:0x01400cb4 ------------------------------------------------------- 7a7a2c00 02018002 79792c00 02018002 l zz,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... <16 bytes per line> --應用修改 BBED> sum dba 5,3252 apply Check value for File 5, Block 3252: current = 0x5732, required = 0x5732 --在sql窗口查看 SQL> select * from tv.t01 where name='zz'; ID NAME -- ---------- 1 zz SQL> --revert是恢復自bbed 啓動以來的全部修改 BBED> revert dba 5,3252 All changes made to this block will be rolled back. Proceed? (Y/N) y Reverted file '/u01/app/oracle/oradata/ORCL/datafile/test_01.dbf', block 3252 BBED> dump /v offset 5530 count 128 File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5) Block: 3252 Offsets: 5530 to 5657 Dba:0x01400cb4 ------------------------------------------------------- 77772c00 02018002 79792c00 02018002 l ww,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... 79792c00 02018002 79792c00 02018002 l yy,.....yy,..... <16 bytes per line> --應用修改 BBED> sum apply Check value for File 5, Block 3252: current = 0x5a3f, required = 0x5a3f BBED> --在sql窗口查看 SQL> alter system set events = 'immediate trace name flush_cache'; System altered. SQL> select * from tv.t01 where name='zz'; no rows selected SQL>
BBED> modify /c zz offset 5530 File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5) Block: 3252 Offsets: 5530 to 5657 Dba:0x01400cb4 ------------------------------------------------------------------------ 7a7a2c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 <32 bytes per line> --應用 BBED> sum apply Check value for File 5, Block 3252: current = 0x5732, required = 0x5732 --回滾,即便被應用的數據也會被回滾 BBED> undo BBED> modify /x 7777 filename '/u01/app/oracle/oradata/ORCL/datafile/test_01.dbf' block 3252. offset 5530. File: /u01/app/oracle/oradata/ORCL/datafile/test_01.dbf (5) Block: 3252 Offsets: 5530 to 5657 Dba:0x01400cb4 ------------------------------------------------------------------------ 77772c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 79792c00 02018002 <32 bytes per line> BBED> sum apply Check value for File 5, Block 3252: current = 0x5a3f, required = 0x5a3f BBED>
將一個block 標記爲corrupt,這樣db 在操做時就會跳過該block,從而避免錯誤
BBED> corrupt dba 5,3252
Block marked media corrupt.
BBED>
注意: undo 命令不能undo 一個corruption,可是revert 命令卻能夠
--整理自網絡http://blog.csdn.net/tianlesoftware/article/details/5006580