[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无法知道该块是否修改过,或者是逻辑损坏的.