[20140424]oracle的邏輯壞塊.txt

lfree發表於2014-04-24

[20140424]oracle的邏輯壞塊.txt

今天上午本來想做一個11GR2的Automatic block media repair,連結如下:http://blog.itpub.net/267265/viewspace-1148315/

但是我遇到一個奇怪的問題,檢查和的計算問題:

SYS@test> @ver
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

SCOTT@test> select rowid,a.* from dept1 a where deptno=60;
ROWID                  DEPTNO DNAME          LOC
------------------ ---------- -------------- -------------
AAAcC1AAIAAAACHAAA         60 MMMM           DDDDDz

SCOTT@test> @lookup_rowid AAAcC1AAIAAAACHAAA
    OBJECT       FILE      BLOCK        ROW DBA                  TEXT
---------- ---------- ---------- ---------- -------------------- ----------------------------------------
    114869          8        135          0 8,135                alter system dump datafile 8 block 135 ;

--關閉資料庫.使用bbed看檢查和.

BBED> set width 210
        WIDTH           210

BBED> set dba 8,135
        DBA             0x02000087 (33554567 8,135)

BBED> p *kdbr[0]
rowdata[0]
----------
ub1 rowdata[0]                              @8085     0x2c

BBED> x /rncc
rowdata[0]                                  @8085
----------
flag@8085: 0x2c (KDRHFL, KDRHFF, KDRHFH)
lock@8086: 0x00
cols@8087:    3

col    0[2] @8088: 60
col    1[4] @8091: MMMM
col    2[6] @8096: DDDDDz

BBED> sum
Check value for File 8, Block 135:
current = 0x8a26, required = 0x8a26


--使用bvi修改將'MMMM'替換成'AAAA'.
$ bvi -b 1105920 -s 8192 /u01/app/oracle11g/oradata/test/test01.dbf

BBED> sum
Check value for File 8, Block 135:
current = 0x8a26, required = 0x8a26
--可以發現與上面的一致,都是0x8a26.

--使用bvi修改成'BBBB'.
BBED> sum
Check value for File 8, Block 135:
current = 0x8a26, required = 0x8a26
--可以發現與上面的一致,都是0x8a26.

--使用bvi修改成'AAAM'.
BBED> sum
Check value for File 8, Block 135:
current = 0x8a26, required = 0x8626
--這個時候才出現不一致的情況.

--使用bvi修改成'1234'.
BBED> sum
Check value for File 8, Block 135:
current = 0x8a26, required = 0x8c24
--從這裡看檢查和的計算很容易出現重合的情況.

--繼續測試
SYS@test> startup
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size                  2228784 bytes
Variable Size            1006636496 bytes
Database Buffers          587202560 bytes
Redo Buffers                7344128 bytes
Database mounted.
Database opened.

SCOTT@test> show parameter db_block_
NAME               TYPE     VALUE
------------------ -------- --------
db_block_buffers   integer  0
db_block_checking  string   FULL
db_block_checksum  string   FULL
db_block_size      integer  8192

SCOTT@test> select rowid,a.* from dept1 a where deptno=60;

ROWID                  DEPTNO DNAME          LOC
------------------ ---------- -------------- -------------
AAAcC1AAIAAAACHAAA         60 MMMM           DDDDDz
--結果一致.

--檢視alert*.log
Hex dump of (file 8, block 135) in trace file /u01/app/oracle11g/diag/rdbms/test/test/trace/test_ora_11802_127_0_0_1.trc
Corrupt block relative dba: 0x02000087 (file 8, block 135)
Bad check value found during multiblock buffer read
Data in bad block:
type: 6 format: 2 rdba: 0x02000087
last change scn: 0x0000.c2e5d41e seq: 0x1 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0xd41e0601
check value in block header: 0x8a26
computed block checksum: 0x602
Reading datafile '/u01/app/oracle11g/oradata/test/test01.dbf' for corruption at rdba: 0x02000087 (file 8, block 135)
Reread (file 8, block 135) found same corrupt data (no logical check)
Starting background process ABMR
Thu Apr 24 10:59:45 2014
ABMR started with pid=39, OS id=11804
Automatic block media recovery service is active.
Automatic block media recovery requested for (file# 8, block# 135)
Thu Apr 24 10:59:46 2014
Automatic block media recovery successful for (file# 8, block# 135)
Automatic block media recovery successful for (file# 8, block# 135)

--看來如果檢查和出現重合的情況,oracle無法知道該塊是否修改過,或者是邏輯損壞的.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-1148366/,如需轉載,請註明出處,否則將追究法律責任。

相關文章