[20160531]windows下bbed修復corrupt資料塊
[20160531]windows下bbed修復corrupt資料塊.txt
--昨天別人的問題,使用windows下的bbed修復corrupt資料塊報錯.我自己也重複測試看看:
--bbed在windows的安裝看:
http://blog.itpub.net/267265/viewspace-2109019/
1.環境:
SCOTT@book> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SCOTT@book> create table dept2 tablespace tea as select * from dept ;
Table created.
SCOTT@book> select ora_rowscn,rowid,dept2.* from dept2 ;
ORA_ROWSCN ROWID DEPTNO DNAME LOC
------------ ------------------ ------------ -------------- -------------
13238134154 AAAW9NAAHAAAACDAAA 10 ACCOUNTING NEW YORK
13238134154 AAAW9NAAHAAAACDAAB 20 RESEARCH DALLAS
13238134154 AAAW9NAAHAAAACDAAC 30 SALES CHICAGO
13238134154 AAAW9NAAHAAAACDAAD 40 OPERATIONS BOSTON
SCOTT@book> @ &r/rowid AAAW9NAAHAAAACDAAA
OBJECT FILE BLOCK ROW DBA TEXT
------------ ------------ ------------ ------------ -------------------- ----------------------------------------
94029 7 131 0 7,131 alter system dump datafile 7 block 131 ;
SCOTT@book> alter system checkpoint;
System altered.
SCOTT@book> select * from v$dbfile where file#=7;
FILE# NAME
------------ ----------------------------------------
7 /mnt/ramdisk/book/tea01.dbf
2.複製資料檔案到windows:
BBED> set dba 7,132
DBA 0x01c00084 (29360260 7,132)
--//注意windwos下block+1.
BBED> p kcbh
struct kcbh, 20 bytes @0
ub1 type_kcbh @0 0x06
ub1 frmt_kcbh @1 0xa2
ub1 spare1_kcbh @2 0x00
ub1 spare2_kcbh @3 0x00
ub4 rdba_kcbh @4 0x01c00083
ub4 bas_kcbh @8 0x150de58c
ub2 wrp_kcbh @12 0x0003
ub1 seq_kcbh @14 0x02
ub1 flg_kcbh @15 0x04 (KCBHFCKV)
ub2 chkval_kcbh @16 0x443c
ub2 spare3_kcbh @18 0x0000
BBED> p tailchk
ub4 tailchk @8188 0xe58c0602
按照文件的說明:
seq_kcbh 表示Sequence number,incremented for every change made to the block at the same SCN.
tailchk 看文件 包括 SCN base+type+SCN seq.
BBED> corrupt
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
Block marked media corrupt.
BBED> sum apply
Check value for File 7, Block 132:
current = 0xf135, required = 0xf135
BBED> verify
DBVERIFY - Verification starting
FILE = R:\tea01.dbf
BLOCK = 131
Block 131 is corrupt
***
Corrupt block relative dba: 0x01c00083 (file 0, block 131)
Bad header found during verification
Data in bad block -
type: 6 format: 2 rdba: 0x01c00084
last change scn: 0x0000.00000000 seq: 0xff flg: 0x04
consistency value in tail: 0x000006ff
check value in block header: 0xf135, computed block checksum: 0x0
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
--//verify 報錯.
BBED> p seq_kcbh
ub1 seq_kcbh @14 0xff
BBED> p tailchk
ub4 tailchk @8188 0x000006ff
--//修復,正常這樣修復很簡單,就是設定seq_kcbh=0x01,tailchk=0x00000601.
BBED> assign seq_kcbh=0x01
ub1 seq_kcbh @14 0x01
BBED> assign tailchk=0x00000601
ub4 tailchk @8188 0x00000601
BBED> sum apply
Check value for File 7, Block 132:
current = 0xf135, required = 0xf135
BBED> verify
DBVERIFY - Verification starting
FILE = R:\tea01.dbf
BLOCK = 131
Block 131 is corrupt
***
Corrupt block relative dba: 0x01c00083 (file 0, block 131)
Bad header found during verification
Data in bad block -
type: 6 format: 2 rdba: 0x01c00084
last change scn: 0x0000.00000000 seq: 0x1 flg: 0x04
consistency value in tail: 0x00000601
check value in block header: 0xf135, computed block checksum: 0x0
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
--//verify 報錯.注執行上面這些在linux下已經正常修復了.
BBED> p kcbh
struct kcbh, 20 bytes @0
ub1 type_kcbh @0 0x06
ub1 frmt_kcbh @1 0x02
ub1 spare1_kcbh @2 0x00
ub1 spare2_kcbh @3 0x00
ub4 rdba_kcbh @4 0x01c00084
ub4 bas_kcbh @8 0x00000000
ub2 wrp_kcbh @12 0x0000
ub1 seq_kcbh @14 0x01
ub1 flg_kcbh @15 0x04 (KCBHFCKV)
ub2 chkval_kcbh @16 0xf135
ub2 spare3_kcbh @18 0x0000
--//scn設定為0,不行嗎?設定bas_kcbh看看:
BBED> p ktbbh.ktbbhitl[0].ktbitbas
ub4 ktbitbas @64 0x150de58a
BBED> assign kcbh.bas_kcbh=0x150de58a
ub4 bas_kcbh @8 0x150de58a
--注意tailchk要修改為0xe58a0601,前面4位來之kcbh.bas_kcbh的後4位.
BBED> sum apply
Check value for File 7, Block 132:
current = 0xe438, required = 0xe438
BBED> verify
DBVERIFY - Verification starting
FILE = R:\tea01.dbf
BLOCK = 131
Block 131 is corrupt
***
Corrupt block relative dba: 0x01c00083 (file 0, block 131)
Bad header found during verification
Data in bad block -
type: 6 format: 2 rdba: 0x01c00084
last change scn: 0x0000.150de58a seq: 0x1 flg: 0x04
consistency value in tail: 0xe58a0601
check value in block header: 0xe438, computed block checksum: 0x0
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
--//依舊報錯,這次仔細看發現rdba: 0x01c00084變成了偶數,我修改的塊dba=7,131後面是奇數.
--//8*16+4=132,如果你看修改前的kcbh.rdba_kcbh=0x01c00083.
--//很明顯在bbed下執行corrupt修改了kcbh.rdba_kcbh.
--//問題因為在windows下使用訪問塊時+1而導致的錯誤,所以講windows下使用要小心.
BBED> p kcbh.rdba_kcbh
ub4 rdba_kcbh @4 0x01c00084
BBED> assign kcbh.rdba_kcbh=0x01c00083
ub4 rdba_kcbh @4 0x01c00083
BBED> sum apply
Check value for File 7, Block 132:
current = 0xe43f, required = 0xe43f
BBED> verify
DBVERIFY - Verification starting
FILE = R:\tea01.dbf
BLOCK = 131
DBVERIFY - Verification complete
Total Blocks Examined : 1
Total Blocks Processed (Data) : 1
Total Blocks Failing (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing (Index): 0
Total Blocks Empty : 0
Total Blocks Marked Corrupt : 0
Total Blocks Influx : 0
--Ok,透過,總之在windows下使用要注意.
--我一直感覺很奇怪bbed在9i下正常的,而到了10g,11g訪問塊都要加一個塊,不知道為什麼,因為32位與64位的區別嗎?
--有計劃找一臺32位的機器測試看看.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2109558/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- BBED (Oracle Block Brower and EDitor Tool) :資料塊修復工具OracleBloC
- bbed_recover:恢復資料塊資料庫資料庫
- --bbed_recover:恢復資料塊資料庫(mybbed)資料庫
- bbed_recover:恢復資料塊資料庫(續)資料庫
- Oracle_UNDO壞塊測試和修復(BBED)Oracle
- 利用BBED修改資料塊SCN----極端環境下的資料恢復資料恢復
- BBED修復資料庫常用命令介紹資料庫
- 修復損壞的資料塊
- Oracle資料庫壞塊修復Oracle資料庫
- Windows下修復mbrWindows
- ORACLE中修復資料塊損壞Oracle
- 修復資料庫壞塊之五資料庫
- 修復資料庫壞塊之四資料庫
- 修復資料庫壞塊之三資料庫
- 修復資料庫壞塊之二資料庫
- 修復資料庫壞塊之一資料庫
- 修復已經CORRUPTED的資料塊
- ORACLE 10g中使用BBED修復損壞資料檔案Oracle 10g
- oracle bbed修改資料塊的例子Oracle
- 資料庫壞塊Corrupt block的處理方法資料庫BloC
- Oracle中匯出修復資料塊損壞Oracle
- Oracle中模擬修復資料塊損壞Oracle
- [20160329]bbed修復offline的資料檔案.txt
- 【BBED】使用bbed恢復已經刪除的行資料
- 利用RMAN修復資料檔案中的壞塊
- 6_Oracle truncate異常恢復之bbed修復Oracle
- 資料庫修復資料恢復資料庫資料恢復
- Oracle 之利用BBED修改資料塊SCN----沒有備份資料檔案的資料恢復Oracle資料恢復
- 這裡有個偏方,修復資料塊用的,我轉貼一下
- [20170419]bbed探究資料塊.txt
- 恢復資料,資料塊恢復
- 【資料庫資料恢復】windows server下SqlServer資料庫的資料恢復資料庫資料恢復WindowsServerSQL
- RMAN修復壞塊
- 使用BBED幫助理解Oracle資料塊結構Oracle
- RMAN修復無效的資料塊(ORA-01578)
- PostgreSQL 恢復大法 - 恢復部分資料庫、跳過壞塊、修復無法啟動的資料庫SQL資料庫
- 勒索病毒資料修復恢復
- [20210401]使用bbed讀取資料塊恢復注意6.txt