一、DBV 说明

DBV是一个常用的工具,OracleMOS上有一篇文章介绍DBV:[ID 35512.1]。

dbverify工具的主要目的是为了检查数据文件的物理结构,包括数据文件是否损坏,是否存在逻辑坏块,以及数据文件中包含何种类型的数据。

DBV checks Oracledatafiles to ensure that:

(1)The datafile has a valid header

(2)Each datablock in the file has aspecial "wrapper" which identifies the block - this"wrapper" is checked for correctness

(3)DATA (TABLE) and INDEX blocks areinternally consistent

(4)From 8.1.6 onwards: That variousother block types are internally           consistent (such as rollback segmentblocks)

The tool can be used to give some degree of confidence that a datafile is free fromcorruption. It opens files in a read only mode and so cannot change thecontents of the file being checked.

DBVERIFY工具可以验证ONLINE或OFFLINE的数据文件。不管数据库是否打开,都可以访问数据文件。

注意:

(1)对于DBVERIFY工具,高版本可以自动识别低版本数据库,比如11g的dbv访问9i的数据库,但是低版本的dbv访问高版本会报如下之类的错误:

DBVERIFY-验证正在开始: FILE =e:/oracle/oradata/Dave/test01.dbf

汇入的页1 -可能是介质损坏

(2)查看数据坏块所在数据文件号及块号可以对表进行一次全表扫描,如:

select count(*) from tablename;

如果有坏块, 在扫描的时候就会报错。

二、DBV 的命令参数

C:/>dbv help=y

DBVERIFY: Release 11.1.0.7.0 - Productionon 星期二 12月 15 23:35:24 2009

Copyright (c) 1982, 2007, Oracle. Allrights reserved.

关键字 说明 (默认值)

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

FILE 要验证的文件 (无)

START 起始块 (文件的第一个块)

END 结束块 (文件的最后一个块)

BLOCKSIZE 逻辑块大小 (8192)

LOGFILE 输出日志 (无)

FEEDBACK 显示进度 (0)

PARFILE 参数文件 (无)

USERID 用户名/口令 (无)

SEGMENT_ID 段 ID (tsn.relfile.block) (无)

HIGH_SCN 要验证的最高块 SCN (无)

(scn_wrap.scn_base 或 scn)

(1)FILE(File to Verify):This is the name of the file to verify.    See"Limitations" below if your datafile name has no suffix.

(2)START(Start Block):This is the first datablock to check in   the file.This defaults to the first block in the file and need only be  specifiedif you want to check just a portion of a given file.

(3)END(End Block):This is the last datablock to check in the  file. Thisdefaults to the last block of  the filebut may need specifying for RAW  devices(See "Limitations" below)  BLOCKSIZE  Logical Block Size This is the database blocksize of the datafile you wish to scan. The value defaults to "2048". Thisparameter must be set to the  DB_BLOCK_SIZE of the datafile to be scanned.

(4)LOGFILE(Output Log):This is the name of file to outputthe results to. The default is "NONE" and output is sent to terminal.

(5)FEEDBACK( Display Progress):  If set to a value above 0 (the default)   then DBVoutputs a "." for every N pages of the datafile checked. This isuseful to see that DBV is working through the ile.

(6)PARFILE(Parameter file):Parameters can be specified in a parameterfile and PARFILE used to cause  the filecontents to be used as input parameters. The PARFILE can contain any of theabove options.

(7)HIGH_SCN(Scn):Highest Block SCN To Verify (scn_wrap.scn_base OR scn) Find theblocks exceeding the SCN. Available in version 9.2.0.6 and above.

(8)USERID (Username/Password):If the file you are verifying isan Automatic Storage Management (ASM) file, you must supply a USERID. This isbecause DBVERIFY needs to connect to an Oracle instance to access ASM files.

(9)SEGMENT_ID (TS#.FILE#.BLOCK#):Specifies the segment that youwant to verify.  For more info, review Note:139962.1

三、DBV 限制

3.1 As DBV performs checks at a block levelit cannot detect problems such as INDEX versus TABLE mismatches which can bedetected by the 'ANALYZE TABLE  VALIDATE STRUCTURE CASCADE' command.

3.2  This utility can ONLY be used against DATAfiles.  It CANNOT be used to verify redolog files or control files.

3.3 You can use DBV to verify an AutomaticStorage Management (ASM) file.

However, the database must be opened and the option USERID has to beused

Example : dbv file=+DG1/ORCL/datafile/system01.dbf userid=system/sys

DBV checks the userid/password for ASM managed files, which is notpossible when database is not open.

3.4 On most releases on Unix DBV expects afilename extension.

This means that DBV cannot be used against datafiles with no filenamesuffix, or against RAW devices. --DBV 要求datafile 必须有扩展名

The workaround is to create a symbolic link to the raw device where thelink name MUST have an extension.

Eg: ln -s /dev/rdsk/mydevice /tmp/mydevice.dbf

Now use DBV against /tmp/mydevice.dbf

--如果裸设备没有扩展名,可以创建一个link,然后在进行dbv 检查。

3.5 For RAW devices you should use the ENDparameter to avoid running off the end of the Oracle file space.

eg: "dbv FILE=/dev/rdsk/r1.dbf END="

Ifyou get the END value too high DBV can report the last page/s of the file ascorrupt as these are beyond the end of the Oracle portion of the raw device.

You can find value for END from the V$DATAFILE view by dividing the BYTESvalue by the database block size.

Eg: To find out the END value to use for file#=5:

SVRMGRL> show parameter db_block_size

NAME                   TYPE   VALUE

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

db_block_size              integer 2048

SVRMGRL> select BYTES/2048 from v$datafile where FILE#=5;

BYTES/2048

----------

5120

So the command would be:

dbvfile=/dev/rdsk/r1.dbf blocksize=2048 END=5120

--SVRMGRL 命令在oracle 10g已经取消,并且db_block_size 默认值也变成了8k。

3.6 DBV may not be able to scan datafileslarger than 2Gb and may report "DBV-100". This is reported in Bug:710888for Unix and Bug:1372172for 8.1.6 on NT. This problem is platform and release specific so if you getDBV-100 errors check the filesize first.

3.7 DBV from 8.1.6 onwards may reportspurious errors for rollback segment     blocks if the database has been migratedfrom Oracle7. See Bug:1359160and Note:118008.1.

3.8 DBV only checks a block in isolation -it does not know if the block is part of an existing object or not.

3.9 DBV is broken on SCO Unix - see Bug:814249

3.10 DBV of a lower version should not beused against a higher DB version.

四、DBV 示例

4.1 验证ASM 上的文件

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)

4.2 验证普通datafile

--实例没有启动的情况下进行datafile 验证

D:\app\Administrator\oradata\newccs>dbvfile=undotbs01.dbf

DBVERIFY: Release 11.2.0.1.0 - Productionon Tue Aug 9 21:52:41 2011

Copyright (c) 1982, 2009, Oracle and/or itsaffiliates.  All rights reserved.

DBVERIFY - Verification starting : FILE =D:\APP\ADMINISTRATOR\ORADATA\NEWCCS\UNDOTBS01.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): 35199

Total Pages Processed (Seg)  : 10

Total Pages Failing   (Seg) : 0

Total Pages Empty            : 28801

Total Pages Marked Corrupt   : 0

Total Pages Influx           : 0

Total Pages Encrypted        : 0

Highest block SCN            : 1315907818 (0.1315907818)

--这种情况下,db没有启动,要进入数据文件的存放目录后在运行该命令,不然会报找不到数据文件。

4.3 DB open 状态,验证指定段

命令格式如下:

dbv USERID=username/passwordSEGMENT_ID=tsn.relfile.block

可以通过sys_dba_segs表获取tablespace_id,header_file, header_block三个字段,他们分别对应tsn,relfile,block.

SYS@anqing2(rac2)> select tablespace_id,header_file, header_block from sys_dba_segs where segment_name = 'TA';

TABLESPACE_ID HEADER_FILE HEADER_BLOCK

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

0           1        71513

[oracle@rac2 ~]$ dbv segment_id=0.1.71513 userid=sys/oracle

DBVERIFY: Release 10.2.0.4.0 - Productionon Tue Aug 9 21:59:32 2011

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

DBV-00111: OCI failure(1913) (ORA-28009: connection as SYS should be as SYSDBA or SYSOPER

)

[oracle@rac2 ~]$ dbvsegment_id=0.1.71513 userid=system/oracle

DBVERIFY: Release 10.2.0.4.0 - Productionon Tue Aug 9 21:59:46 2011

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

DBVERIFY - Verification starting :SEGMENT_ID = 0.1.71513

DBVERIFY - Verification complete

Total Pages Examined         : 2281

Total Pages Processed (Data) : 2280

Total Pages Failing   (Data) : 0

Total Pages Processed (Index): 0

Total Pages Failing   (Index): 0

Total Pages Processed (Other): 0

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            : 0 (0.0)

[oracle@rac2 ~]$

注:这种方式要求数据库处于打开的状态。

4.4 验证数据拷贝

由于dbv可以在实例关闭情况下验证数据文件,因此dbv也可以验证数据文件的拷贝。这个拷贝指的是通过RMAN的COPY命令或者操作系统命令cp拷贝的数据文件,而不是RMAN生成的备份集格式。

如:

E:/app/Administrator/oradata/orcl>dbvfile= USERS01bak.DBF blocksize=8192

DBVERIFY: Release 11.1.0.7.0 - Productionon 星期三 12月 16 00:30:17 2009

Copyright (c) 1982, 2007, Oracle. Allrights reserved.

DBVERIFY - 开始验证: FILE = E:/app/Administrator/oradata/orcl/USERS01bak.DBF

DBVERIFY - 验证完成

检查的页总数: 640

处理的页总数 (数据): 91

失败的页总数 (数据): 0

处理的页总数 (索引): 33

失败的页总数 (索引): 0

处理的页总数 (其它): 496

处理的总页数 (段) : 0

失败的总页数 (段) : 0

空的页总数: 20

标记为损坏的总页数: 0

流入的页总数: 0

加密的总页数 : 0

最高块 SCN :904088 (0.904088)

通过比较2个dbv 的结果来比较datafile 的copy

oracle dbv验证,Oracle DBV工具说明相关推荐

  1. oracle本地验证,Oracle 本地验证和密码文件

    实验: oracle服务器位于Linux操作系统,客户端位于windows操作系统. 首先,查看remote_login_passwordfile参数值: SYS@orcl 11-SEP-14> ...

  2. oracle dblink 验证,Oracle DBLINK 简单使用

    oracle在进行跨库访问时,可以通过创建dblink实现,今天就简单的介绍下如果创建dblink,以及通过dblink完成插入.修改.删除等操作 首先了解下环境:在tnsnames.ora中配置两个 ...

  3. oracle dblink 验证,oracle通过dblink查询sqlserver报错

    报错如下: SQL> select * from t@mstest; select * from t@test * ERROR at line 1: ORA-28545: error diagn ...

  4. 【dbv】使用dbv工具检验数据文件是否有坏块

    dbv工具可以用来验证数据文件的有效性,在数据库恢复之前可以使用该命令对备份文件进行有效性检查,防止因备份文件本身的问题导致数据库无法恢复. 当然,dbv命令也可以对在线的数据文件进行检查. 注意,d ...

  5. oracle 数据块 修复,案例:Oracle坏块 使用RMAN工具的命令clear标记数据块为corrupt 修复坏块...

    天萃荷净 运维DBA巡检发现数据文件中存在坏块,使用RMAN工具的命令clear标记数据坏块,使用bbed修复坏块 在rman中有隐藏的命令clear,可以标记数据块为corrupt,从而实现数据库坏 ...

  6. centos 7 如何验证oracle安装成功_linux下Oracle数据的安装详解

    第二章:CentOS下Oracle用户环境配置和Oracle11g的安装: 1.下载Oracle安装包: linux.x64_11gR2_database_1of2.zip 和 linux.x64_1 ...

  7. Oracle RDA(Remote Diagnostic Agent) 工具说明

    Oracle RDA(Remote Diagnostic Agent) 工具说明 分类: Oracle 性能调优 Oracle 高级知识  一.RDA 说明 RDA(RemoteDiagnostic ...

  8. 查看本地oracle密码是多少钱,Oracle 本地验证和密码文件

    fileINTERNAL 6A75B1BBE50E66AB 4DE42795E66117AE 在数据库没有启动之前,数据库的内建用户是无法通过数据库本身来验证身份的,通过密码文件, oracle就可以 ...

  9. oracle for 记录数,可视化工具dbForge Documenter for Oracle全新上线!让您轻松记录Oracle数据库...

    dbForge Documenter for Oracle是一个用于记录Oracle数据库的便捷可视化工具.此Oracle文档工具以HTML,PDF和MARKDOWN文件格式自动生成整个Oracle数 ...

  10. macbook oracle 工具,Navicat for Oracle Mac 四种实用工具

    Navicat for Oracle Mac 凭借精心设计的用户界面,可以简便快捷地以安全且简单的方法创建.组织.访问和共享信息,优化 Oracle 管理.除了 Oracle 的核心功能外,Navic ...

最新文章

  1. VMware vSphere 6.5 配置文档
  2. 第五章 深度神经网络为何很难训练
  3. Android --- java.lang.RuntimeException: Can‘t create handler inside thread that has not called Loop
  4. The hierarchy of the type is inconsistent
  5. Caffe抽取图像特征
  6. Nginx全局块的其他配置指令
  7. 文本聊天室(TCP-中)
  8. sql server 之函数小技巧 整数类型为空是用空字符串替代实现
  9. 洛谷P2680:运输计划(倍增、二分、树上差分)
  10. Linux内存管理之基本概念介绍(一)
  11. php获取当前页面select的值,关于JS获取select的值
  12. Hive-RCFile文件存储格式
  13. 帮助浏览器、help函数和doc函数 符号表述的数集
  14. HTTP协议下GET与POST的区别
  15. myeclipse 创建work set 后不显示的解决方法
  16. web.xml配置以及一些详解
  17. android设置计算器页面布局,Android计算器界面布局
  18. 计算机硬盘使用率,硬盘占用率和速度
  19. LPC1788学习笔记(19-01-11)
  20. OPNsense用户手册-高可用性和硬件故障转移

热门文章

  1. chariot iperf使用_iperf局域网性能工具
  2. 微信能通过服务器改数据解封吗,【微信新规】微信永久封号官方解封方法
  3. Windows批处理-for命令详解
  4. spring5-介绍Spring框架
  5. 简单的 js 日历控件
  6. JAVA算法: 给定一个整数转换成对应的罗马字符(Integer to Roman)
  7. VAX使用技巧,所有VS版本通用
  8. CUDA学习(十一) 利用npp做图像处理
  9. Django入门文档
  10. 【0201】用户登录界面设计