ITPub博客

首页 > Linux操作系统 > Linux操作系统 > DBVERIFY utility的使用

DBVERIFY utility的使用

原创 Linux操作系统 作者:keeptrying 时间:2012-05-07 20:49:24 0 删除 编辑

一、DBVERIFY工具介绍

DBVERIFY is an external command-line utility that performs a physical data structure integrity check. It can be used on offline or online databases, as well on backup files. You use DBVERIFY primarily when you need to ensure that a backup database (or datafile) is valid before it is restored or as a diagnostic aid when you have encountered data corruption problems.

DBVERIFY checks are limited to cache-managed blocks (that is, data blocks). Because DBVERIFY is only for use with datafiles, it will not work against control files or redo logs.

是一个运行于操作系统提示符下的外部程序;

用于执行物理数据结构一致性检查;

可以用于验证Onlineoffline状态下的数据文件、复制的数据文件、备份的镜像副本;

不支持控制文件、联机日志文件、归档日志、RMAN备份集验证;

二、使用方法

C:\Users\Administrator>dbv

 

DBVERIFY: Release 10.2.0.3.0 - Production on Mon May 7 20:09:09 2012

 

Copyright (c) 1982, 2005, 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)    --指定block大小,默认值为8192,若不指定,block不为8192,会受到DBV-00103错误

LOGFILE     Output Log                 (NONE)     --通过指定Logfile可以将结果输出到一个文件中。如:“logfile=e:\blk.txt”,结果不会直接显示,而会显示在blk.txt文件中。

FEEDBACK    Display Progress            (0)

PARFILE     Parameter File               (NONE)  --可以指定参数文件。将dbv命令写入一个参数文件中,直接执行该参数文件。"dbv parfile=e:\par.txt".

USERID      Username/Password          (NONE)  --校验段、ASM文件需要使用

SEGMENT_ID  Segment ID (tsn.relfile.block)  (NONE)  --校验段,需要表空间ID、数据文件ID、段的头部ID

HIGH_SCN    Highest Block SCN To Verify    (NONE)

            (scn_wrap.scn_base OR scn)

 

============================================================================================

 

1、  校验onlineoffline数据文件

C:\Users\Administrator>dbv file=E:\oradata\test\test01.dbf

 

DBVERIFY: Release 10.2.0.3.0 - Production on Mon May 7 20:22:35 2012

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

DBVERIFY - Verification starting : FILE = E:\oradata\test\test01.dbf

DBVERIFY - Verification complete

 

Total Pages Examined         : 2560   --校验的总页面数,一个页面即是一个数据块

Total Pages Processed (Data) : 2295      --已处理的数据页面数

Total Pages Failing   (Data) : 0          --已处理的数据页面失败数

Total Pages Processed (Index): 11        --已处理的索引页面数

Total Pages Failing   (Index): 0         --已处理索引页面失败数

Total Pages Processed (Other): 249       --已处理的其他页面数

Total Pages Processed (Seg)  : 0

Total Pages Failing   (Seg)  : 0

Total Pages Empty            : 5

Total Pages Marked Corrupt   : 0

Total Pages Influx           : 0

Highest block SCN            : 3389127 (0.3389127)

 

注意:如果Total Pages Influx大于零,且未存在坏的情下,是由于针对open状态的文件dbv程序遇到了一个当前正在被DBWn入的

 

C:\Users\Administrator>dbv file=E:\oradata\test\test01.dbf feedback=100  --每验证100个块显示一个“.

 

DBVERIFY: Release 10.2.0.3.0 - Production on Mon May 7 20:28:31 2012

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

DBVERIFY - Verification starting : FILE = E:\oradata\test\test01.dbf

..........................

 

DBVERIFY - Verification complete

 

2、  验证指定段

该方法需要获得段所在的表空间ID、段所在的数据文件ID、段的头部ID

SYS@ tsid > select tablespace_id,tablespace_name,header_file,header_block from sys_dba_segs where segment_name='T';

 

TABLESPACE_ID TABLESPACE_NAME                HEADER_FILE HEADER_BLOCK

------------- ------------------------------ ----------- ------------

            4 USERS                                    4           11

 

注意:sys的段可以查询sys_user_segs,而普通用的段信息,需要查询sys_dba_segs

 

C:\Users\Administrator>dbv userid=test/test segment_id=4.4.11

 

DBVERIFY: Release 10.2.0.3.0 - Production on Mon May 7 20:37:00 2012

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

DBVERIFY - Verification starting : SEGMENT_ID = 4.4.11

 

 

DBVERIFY - Verification complete

 

Total Pages Examined         : 8

Total Pages Processed (Data) : 5

Total Pages Failing   (Data) : 0

Total Pages Processed (Index): 0

Total Pages Failing   (Index): 0

Total Pages Processed (Other): 2

Total Pages Processed (Seg)  : 1

Total Pages Failing   (Seg)  : 0

Total Pages Empty            : 0

Total Pages Marked Corrupt   : 0

Total Pages Influx           : 0

Highest block SCN            : 3084884 (0.3084884)

 

3、  验证复制的数据文件或备份集

RMAN> backup as copy datafile 5;  --使用RMAN备份镜像副本

 

Starting backup at 2012-05-07 20:39:58

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=134 devtype=DISK

channel ORA_DISK_1: starting datafile copy

input datafile fno=00005 name=E:\ORADATA\TEST\TEST01.DBF

output filename=E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\TEST\DATAFILE\O1_MF_TEST_7THJO0M1_.DBF tag=TAG20120507T204000 re

cid=1 stamp=782685601

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

Finished backup at 2012-05-07 20:40:01

 

 

C:\Users\Administrator>dbv file=E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\TEST\DATAFILE\O1_MF_TEST_7THJO0M1_.DBF

 

DBVERIFY: Release 10.2.0.3.0 - Production on Mon May 7 20:41:48 2012

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

DBVERIFY - Verification starting : FILE = E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\TEST\DATAFILE\O1_MF_TEST_7THJO0M1_.DBF

 

 

 

DBVERIFY - Verification complete

 

Total Pages Examined         : 2560

Total Pages Processed (Data) : 2295

Total Pages Failing   (Data) : 0

Total Pages Processed (Index): 11

Total Pages Failing   (Index): 0

Total Pages Processed (Other): 249

Total Pages Processed (Seg)  : 0

Total Pages Failing   (Seg)  : 0

Total Pages Empty            : 5

Total Pages Marked Corrupt   : 0

Total Pages Influx           : 0

Highest block SCN            : 3389127 (0.3389127)

 

 

4、  通过指定blocksize可以实现对控制文件的验证

C:\Users\Administrator>dbv file=E:\oradata\test\control01.ctl

 

DBVERIFY: Release 10.2.0.3.0 - Production on Mon May 7 20:44:22 2012

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

 

DBV-00103: Specified BLOCKSIZE (8192) differs from actual (16384)  --根据提示知道blocksize的值为16384

 

C:\Users\Administrator>dbv file=E:\oradata\test\control01.ctl blocksize=16384

 

DBVERIFY: Release 10.2.0.3.0 - Production on Mon May 7 20:45:51 2012

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

DBVERIFY - Verification starting : FILE = E:\oradata\test\control01.ctl

 

 

DBVERIFY - Verification complete

 

Total Pages Examined         : 450

Total Pages Processed (Data) : 0

Total Pages Failing   (Data) : 0

Total Pages Processed (Index): 0

Total Pages Failing   (Index): 0

Total Pages Processed (Other): 61

Total Pages Processed (Seg)  : 0

Total Pages Failing   (Seg)  : 0

Total Pages Empty            : 389

Total Pages Marked Corrupt   : 0

Total Pages Influx           : 0

Highest block SCN            : 6933 (65535.6933)

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25744374/viewspace-722938/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-04-25

  • 博文量
    130
  • 访问量
    945594