Oracle-DBV-工具-说明

更新时间:2023-07-23 07:12:17 阅读: 评论:0

Oracle DBV 工具 说明Oracle DBV 工具 说明
一. 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 gmentblocks)
The tool can be ud 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)查看数据坏块所在数据文件号及块号可以对表进行一次全表扫描,如:
lect count(*) from tablename;
如果有坏块, 在扫描的时候就会报错。
二. dbv的命令参数C:/>dbv help=y
DBVERIFY: Relea 11.1.0.7.0 - Productionon 星期二 12月 15 23:35:24 2009
Copyright (c) 1982, 2007, Oracle. Allrights rerved.失望的英语
关键字 说明 (默认值)
----------------------------------------------------
FILE 要验证的文件 (无)
START 起始块 (文件的第一个块)
END 结束块 (文件的最后一个块)
BLOCKSIZE 逻辑块大小 (8192)
LOGFILE 输出日志 (无)
FEEDBACK 显示进度 (0)
PARFILE 参数文件 (无)
USERID 用户名/口令 (无)
SEGMENT_ID 段 ID (lfile.block) (无)
HIGH_SCN 要验证的最高块 SCN (无)
(scn_wrap.scn_ba 或 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 databa blocksize of the datafile you wish to scan. The value defaults to "2048". Thisparameter must be t 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 nt to terminal.
(5)FEEDBACK( Display Progress):If t to a value above 0 (the default)  then DBVoutputs a "." for every N pages of the datafile checked. This isuful to e that DBV is working through the ile.
(6)PARFILE(Parameter file):Parameters can be specified in a parameterfile and PARFILE ud to cau the filecontents to be ud as input parameters. The PARFILE can contain any of theabove options.
(7)HIGH_SCN(Scn):Highest Block SCN To Verify (scn_wrap.scn_ba OR scn) Find theblocks exceeding the SCN. Available in version 9.2.0.6 and above.
(8)USERID (Urname/Password):If the file you are verifying isan Automatic Storage Management (ASM) file, you must supply a USERID. This isbecau DBVERIFY needs to connect to an Oracle instance to access ASM files.
(9)SEGMENT_ID (TS#.FILE#.BLOCK#):Specifies the gment that youwant to verify. For more info, reviewNote: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 ud against DATAfiles. It CANNOT be ud to verify redolog files or control files.
3.3 You can u DBV to verify an AutomaticStorage Management (ASM) file.
However, the databa must be opened and the option USERID has to beud
Example : dbv file=+DG1/ORCL/datafile/system01.dbf urid=system/sys
DBV checks the urid/password for ASM managed files, which is notpossible when databa is not open.
3.4 On most releas on Unix DBV expects afilename extension.
This means that DBV cannot be ud 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 u DBV against /tmp/mydevice.dbf
--如果裸设备没有扩展名,可以创建一个link,然后在进行dbv 检查。
3.5 For RAW devices you should u the ENDparameter to avoid running off the end of the Oracle file space.
eg: "dbv FILE=/dev/rdsk/r1.dbf END=<last_block_number>"
Ifyou get the END value too high DBV can report the last page/s of the file ascorrupt as the 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 databa block size.
Eg: To find out the END value to u for file#=5:
SVRMGRL> show parameter db_block_size
NAME TYPEVALUE
-
---------------------------------- ------- ------
db_block_size integer 2048
SVRMGRL> lect BYTES/2048 from v$datafile where FILE#=5;
BYTES/2048
----------
5120家眷的意思
So the command would be:
dbvfile=/dev/r
qydsk/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 reporte
d inBug:710888for Unix andBug:1372172for 8.1.6 on NT. This problem is platform and relea specific so if you getDBV-100 errors check the filesize first.
鬼店另有主3.7 DBV from 8.1.6 onwards may reportspurious errors for rollback gment blocks if the databa has been migratedfrom Oracle7. SeeBug:1359160andNote: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 - e Bug:814249
3.10 DBV of a lower version should not beud against a higher DB version.
四. DBV 示例
4.1 验证ASM 上的文件SYS@anqing2(rac2)> lect file_name fromdba_data_Files;
FILE_NAME
--------------------------------------------------------------------------------
+DATA/anqing/datafile/urs.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 上的文件,注意添加urid参数
[oracle@rac2 ~]$ dbvfile='+DATA/anqing/datafile/undotbs02.dbf' urid=sys/oracle
DBVERIFY: Relea 10.2.0.4.0 - Productionon Tue Aug 9 21:44:36 2011
焦虑症的表现症状
Copyright (c) 1982, 2007, Oracle. All rights rerved.
DBVERIFY - Verification starting : FILE =+DATA/anqing/datafile/undotbs02.dbf
DBVERIFY - Verification complete
Total Pages Examined : 64000
Total Pages Procesd (Data) : 0
Total Pages Failing (Data) : 0
Total Pages Procesd (Index): 0
Total Pages Failing (Index): 0
Total Pages Procesd (Other): 32748
Total Pages Procesd (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: Relea 11.2.0.1.0 - Productionon Tue Aug 9 21:52:41 2011
Copyright (c) 1982, 2009, Oracle and/or itsaffiliates. All rights rerved.
DBVERIFY - Verification starting : FILE =D:\APP\ADMINISTRATOR\ORADATA\NEWCCS\UNDOTBS01.DBF
DBVERIFY - Verification complete
Total Pages Examined : 64000
Total Pages Procesd (Data) : 0
Total Pages Failing (Data) : 0
Total Pages Procesd (Index): 0
Total Pages Failing (Index): 0
Total Pages Procesd (Other): 35199
Total Pages Procesd (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=urname/passwordSEGMENT_lfile.block
可以通过sys_dba_gs表获取tablespace_id,header_file, header_block三个字段,他们分别对应tsn,relfile,block.
SYS@anqing2(rac2)> lect tablespace_id,header_file, header_block from sys_dba_gs where gment_name = 'TA';
TABLESPACE_ID HEADER_FILE HEADER_BLOCK
------------- ----------- ------------
0 1 71513
[oracle@rac2 ~]$ dbv gment_id=0.1.71513 urid=sys/oracle
DBVERIFY: Relea 10.2.0.4.0 - Productionon Tue Aug 9 21:59:32 2011
Copyright (c) 1982, 2007, Oracle. All rights rerved.
DBV-00111: OCI failure(1913) (ORA-28009: connection as SYS should be as SYSDBA or SYSOPER
)
[oracle@rac2 ~]$ dbvgment_id=0.1.71513 urid=system/oracle
回归造句
DBVERIFY: Relea 10.2.0.4.0 - Productionon Tue Aug 9 21:59:46 2011
Copyright (c) 1982, 2007, Oracle. All rights rerved.
DBVERIFY - Verification starting :SEGMENT_ID = 0.1.71513
DBVERIFY - Verification complete
Total Pages Examined : 2281
Total Pages Procesd (Data) : 2280
Total Pages Failing (Data) : 0
Total Pages Procesd (Index): 0
Total Pages Failing (Index): 0
Total Pages Procesd (Other): 0
轻微课tencent travelerTotal Pages Procesd (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: Relea 11.1.0.7.0 - Productionon 星期三 12月 16 00:30:17 2009
Copyright (c) 1982, 2007, Oracle. Allrights rerved.
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

本文发布于:2023-07-23 07:12:17,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/186016.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

上一篇:NPI流程介绍
标签:数据文件   验证   是否   数据库   损坏   总数   命令
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图