DBVERIFY工具用来验证数据文件的物理结构完整性,如数据文件是否损坏,是否存在逻辑坏块。
能够验证online或者offline的数据文件(数据库open状态,也可以用dbverify工具),不过使用DBVERIFY检验offline的数据文件速度会更快。
能够验证rman备份的镜像副本;
不能够验control files 和 redo logs。
DBVERIFY工具使用方法
1.在oracle用户下输入dbv回车,显示DBVERIFY帮助信息
[oracle@hou-test ~]$ dbv
DBVERIFY: Release 11.1.0.6.0 - Production on Tue May 14 14:13:25 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Keyword Description (Default)
----------------------------------------------------
FILE File to Verify (NONE) --指定需要验证的文件
START Start Block (First Block of File) --起始块(默认是文件的第一个块)
END End Block (Last Block of File) --结束块(默认是文件的最后一个块)
BLOCKSIZE Logical Block Size (8192) --逻辑块大小(默认8192)
LOGFILE Output Log (NONE) --输出日志
FEEDBACK Display Progress (0) --反馈,显示进度
PARFILE Parameter File (NONE) --参数文件
USERID Username/Password (NONE) --用户名/密码
SEGMENT_ID Segment ID (tsn.relfile.block) (NONE) --段ID
HIGH_SCN Highest Block SCN To Verify (NONE) --要验证的最高块的SCN
(scn_wrap.scn_base OR scn)
2.使用DBVERIFY工具验证单个数据文件时,输出信息说明
<1>数据库open,执行验证
[oracle@hou-test ~]$ dbv file=/u01/app/oracle/oradata/qc005/system01.dbf
DBVERIFY: Release 11.1.0.6.0 - Production on Tue May 14 14:22:15 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/qc005/system01.dbf
DBVERIFY - Verification complete
Total Pages Examined : 90880
Total Pages Processed (Data) : 64541
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 11305
Total Pages Failing (Index): 0
Total Pages Processed (Other): 2730
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 12304
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2146631 (0.2146631)
********************************************************************
Pages = Block --pages就是块
Total Pages Examined = number of blocks in the file --文件中块的总数
Total Pages Processed = number of blocks that were verified (formatted blocks) --验证过的块数(格式化的块数)
Total Pages Failing (Data) = number of blocks that failed the data block checking routine --验证失败的数据块数
Total Pages Failing (Index) = number of blocks that failed the index block checking routine --验证失败的索引块数
Total Pages Marked Corrupt = number of blocks for which the cache header is invalid, thereby making it impossible for DBVERIFY to identify the block type --被标记为坏块的个数
Total Pages Influx = number of blocks that are being read and written to at the same time. If the database is open when DBVERIFY is run, DBVERIFY reads blocks multiple times to get a consistent image. But because the database is open, there may be blocks that are being read and written to at the same time (INFLUX). DBVERIFY cannot get a consistent image of pages that are in flux. --如果Total Pages Influx的值大于零,且未存在坏块的情况下,是由于针对open状态的文件运行dbv程序遇到了一个当前正在被DBWn进程写入的数据块
********************************************************************
<2>数据库关闭,执行验证
[oracle@hou-test ~]$ dbv file=/u01/app/oracle/oradata/qc005/system01.dbf
DBVERIFY: Release 11.1.0.6.0 - Production on Tue May 14 14:22:15 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/qc005/system01.dbf
DBVERIFY - Verification complete
Total Pages Examined : 90880
Total Pages Processed (Data) : 64541
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 11305
Total Pages Failing (Index): 0
Total Pages Processed (Other): 2730
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 12304
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2146631 (0.2146631)
3.使用DBVERIFY工具验证一个segment,输出信息说明
只能在数据库open状态下进行,要加上userid参数。
用来验证表或者索引段,在验证时段会被锁住。
如果验证的是一个索引段,那么索引的父表也会被锁住(注意,索引组织表没有父表)。
首先要获得段所在表空间的ID,段所在数据文件的ID,段的头部ID,这三个ID组成了SEGMENT_ID。
conn / as sysdba
select tablespace_id,tablespace_name,header_file,header_block
from sys_dba_segs
where segment_name='LOG_COUNT';
TABLESPACE_ID TABLESPACE_NAME HEADER_FILE HEADER_BLOCK
------------- ------------------------------ ----------- ------------
6 down 7 11
LOG_COUNT 的 EGMENT_ID=6.7.11
注意:sys用户的段可以查询sys_user_segs,而普通用户的段信息,需要查询sys_dba_segs
[oracle@hou-test ~]$ dbv userid=down/xxx segment_id=6.7.11
DBVERIFY: Release 11.1.0.6.0 - Production on Tue May 14 15:19:06 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : SEGMENT_ID = 6.7.11
DBVERIFY - Verification complete
Total Pages Examined : 28672
Total Pages Processed (Data) : 27949
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 214
Total Pages Processed (Seg) : 1
Total Pages Failing (Seg) : 0
Total Pages Empty : 508
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 924670 (0.924670)
4.验证ASM上的文件(摘自David Dai的博客,未验证)
SYS@anqing2(rac2)> select file_name fromdba_data_Files;
FILE_NAME
--------------------------------------------------------------------------------
+DATA/anqing/datafile/users.273.751548233
+DATA/anqing/datafile/sysaux01.dbf
+DATA/anqing/datafile/undotbs01.dbf
+DATA/anqing/datafile/system01.dbf
+DATA/anqing/datafile/system02.dbf
+DATA/anqing/datafile/undotbs02.dbf
+DATA/anqing/datafile/dave01.dbf
+DATA/anqing/datafile/test01.dbf
--dbv check ASM 上的文件,注意添加userid参数
[oracle@rac2 ~]$ dbvfile='+DATA/anqing/datafile/undotbs02.dbf' userid=sys/oracle
DBVERIFY: Release 10.2.0.4.0 - Productionon Tue Aug 9 21:44:36 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE =+DATA/anqing/datafile/undotbs02.dbf
DBVERIFY - Verification complete
Total Pages Examined : 64000
Total Pages Processed (Data) : 0
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 32748
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 31252
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 0 (0.0)
5.验证数据copy
数据库open和关闭状态下都可验证。
rman中,backup validate database和backup validate database archivelog all用来检查全库是否能备份,
数据库中是否存在坏块不能备份。
而dbv则是检查备份出的拷贝是否存在坏块。
使用rman拷贝数据文件
RMAN> backup as copy datafile 6 format='/home/oracle/datafile6.dbf';
dbv验证拷贝
[oracle@hou-test ~]$ dbv file=/home/oracle/datafile6.dbf
DBVERIFY: Release 11.1.0.6.0 - Production on Tue May 14 16:11:46 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = /home/oracle/datafile6.dbf
DBVERIFY - Verification complete
Total Pages Examined : 297984
Total Pages Processed (Data) : 283089
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 615
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 14280
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2157386 (0.2157386)
*******
参考:
http://blog.csdn.net/tianlesoftware/article/details/5015164
http://blog.csdn.net/robinson_0612/article/details/6530890
*******
阅读(5289) | 评论(0) | 转发(0) |