物理一致性和逻辑一致性检查
TS# HEADER_FILE HEADER_BLOCK
---------- ----------- ------------
0 1 56377
DBV工具
特点:只读,不会做修改
可以在线检查,不需要关闭数据库。
不能检查控制文件和日志文件,而
只能检查数据文件
可以检查ASM文件,但数据库必须open,需要通过USERID指定用户
比如dbv file=+DG1/ORCL/datafile/system01.dbf userid=system/sys
在许多UNIX平台下,DBV要求数据文件有扩展名。如果没有(裸设备)可以通过建立链接,然后对链接文件进行操作,比如:ln -s /dev/rdsk/mydevice /tmp/mydevice.dbf
某些平台下,DBV工具不能检查超过2GB的文件,如果碰到DBV-100错误,请先检查文件大小,Metalink Bug 710888 对这个问题有描述。
可直接输入dbv 获取帮助
BLOCKSIZE,要与检查的文件的blocksize一致。缺省8192
SEGMENT_ID,可以指定要检查的段<tsn.segfile,segblock>
例子1、检查users01.dbf
[oracle@Rhel5 ~]$ dbv file=/u01/oradata/10G101/users01.dbf blocksize=8192
file要输入绝对路径,否则可能会报dbv-600错误
DBVERIFY: Release 10.2.0.5.0 - Production on Mon Aug 5 23:34:28 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = /u01/oradata/10G101/system01.dbf
Page 28618 is marked corrupt
Corrupt block relative dba: 0x00406fca (file 1, block 28618)
Bad check value found during dbv:
Data in bad block:
type: 6 format: 2 rdba: 0x00406fca
last change scn: 0x0000.00029ab9 seq: 0x1 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x9ab90601
check value in block header: 0xc694
computed block checksum: 0x7400
DBVERIFY - Verification complete
Total Pages Examined : 57600
Total Pages Processed (Data) : 38088
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 7049
Total Pages Failing (Index): 0
Total Pages Processed (Other): 1867
Total Pages Processed (Seg) : 1
Total Pages Failing (Seg) : 0
Total Pages Empty : 10595
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Highest block SCN : 676674 (0.676674)
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = /u01/oradata/10G101/system01.dbf
Page 28618 is marked corrupt
Corrupt block relative dba: 0x00406fca (file 1, block 28618)
Bad check value found during dbv:
Data in bad block:
type: 6 format: 2 rdba: 0x00406fca
last change scn: 0x0000.00029ab9 seq: 0x1 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x9ab90601
check value in block header: 0xc694
computed block checksum: 0x7400
DBVERIFY - Verification complete
Total Pages Examined : 57600
Total Pages Processed (Data) : 38088
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 7049
Total Pages Failing (Index): 0
Total Pages Processed (Other): 1867
Total Pages Processed (Seg) : 1
Total Pages Failing (Seg) : 0
Total Pages Empty : 10595
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Highest block SCN : 676674 (0.676674)
例子2、检查segment TEST
查看对象的tsn、segfile、segblock
SQL> select t.ts#,s.header_file,s.header_block
from v$tablespace t,dba_segments s
where s.segment_name='TEST
and t.name=s.tablespace_name;
from v$tablespace t,dba_segments s
where s.segment_name='TEST
and t.name=s.tablespace_name;
TS# HEADER_FILE HEADER_BLOCK
---------- ----------- ------------
0 1 56377
[oracle@Rhel5 10G101]$ dbv userid=system/password segment_id=0.1.56377
DBVERIFY: Release 10.2.0.5.0 - Production on Mon Aug 5 23:03:54 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : SEGMENT_ID = 0.1.56377
DBVERIFY - Verification complete
Total Pages Examined : 2
Total Pages Processed (Data) : 1
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 0
Total Pages Processed (Seg) : 1s
Total Pages Failing (Seg) : 0
Total Pages Empty : 0
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Highest block SCN : 666485 (0.666485)
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : SEGMENT_ID = 0.1.56377
DBVERIFY - Verification complete
Total Pages Examined : 2
Total Pages Processed (Data) : 1
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 0
Total Pages Processed (Seg) : 1s
Total Pages Failing (Seg) : 0
Total Pages Empty : 0
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Highest block SCN : 666485 (0.666485)
也可以使用RMAN工具来确认位置RMAN> backup check logical validate datafile 1;结果查询:SQL> select file#,block#,blocks from v$database_block_corruption;
FILE# BLOCK# BLOCKS---------- ---------- ----------1 28618 1