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 a special wrapper which identifies the block - thiswrapper is checked for correctness
(3)DATA (TABLE) and INDEX blocks are internally consistent
(4)From 8.1.6 onwards: That various other block types are internally consistent (such as rollback segmentblocks)
(1)The datafile has a valid header
(2)Each datablock in the file has a special wrapper which identifies the block - thiswrapper is checked for correctness
(3)DATA (TABLE) and INDEX blocks are internally consistent
(4)From 8.1.6 onwards: That various other 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 from corruption. 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;
如果有壞塊, 在掃描的時候就會報錯。
(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)
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. SeeLimitations 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, reviewNote:139962.1
(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, 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 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
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 檢查。
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=last_block_number
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.
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 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 TYPEVALUE
----------------------------------- ------- ------
db_block_size integer 2048
SVRMGRL show parameter db_block_size
NAME TYPEVALUE
----------------------------------- ------- ------
db_block_size integer 2048
SVRMGRL select BYTES/2048 from v$datafile where FILE#=5;
BYTES/2048
----------
5120
BYTES/2048
----------
5120
So the command would be:
dbvfile=/dev/rdsk/r1.dbf blocksize=2048 END=5120
--SVRMGRL 命令在oracle 10g已經取消,並且db_block_size 預設值也變成了8k。
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 inBug:710888for Unix andBug: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. 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 - 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
[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)
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\newccsdbvfile=undotbs01.dbf
D:\app\Administrator\oradata\newccsdbvfile=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)
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
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
------------- ----------- ------------
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 ~]$
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/orcldbvfile= 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)
E:/app/Administrator/oradata/orcldbvfile= 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
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26870952/viewspace-1867559/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle DBV 工具 介紹Oracle
- Oracle BBED 工具 說明Oracle
- Oracle BBED 工具說明Oracle
- 用Excel做資料說明――抽樣說明工具Excel
- 【dbv】使用dbv工具檢驗資料檔案是否有壞塊
- exp,imp相關工具說明
- Oracle DUL/AUL/ODU 工具說明Oracle
- MySQL 5.7 mysqlpump 備份工具說明MySql
- opatch 工具打補丁使用說明
- LogMiner日誌分析工具說明
- 流量控制工具TC詳細說明
- Android資源混淆工具使用說明Android
- sql注入工具sqlmap使用引數說明SQL
- mysql語句分析工具explain使用說明MySqlAI
- Oracle 更新 OPatch 工具版本 的方法 說明Oracle
- Ubuntu修改Hosts檔案工具HostsTool使用說明Ubuntu
- xming工具的簡單實用說明
- Oracle 9i LogMiner工具使用說明Oracle
- RHEL 7特性說明(七):編譯程式及工具編譯
- 計劃任務工具 cron 的配置和說明
- SYSAUX 說明UX
- 使用說明
- Hack 說明
- 專利說明書及其說明書附圖
- Cz工具集使用介紹 - 規範Git提交說明Git
- Oracle 12.2對客戶端工具的支援說明Oracle客戶端
- (轉)計劃任務工具 cron 的配置和說明
- openssh版本更新與說明 openssl版本更新與說明
- WebApiClientCore使用說明WebAPIclient
- QLExpress使用說明Express
- postman 使用說明Postman
- SDWebImage中文說明Web
- objc物件說明OBJ物件
- MOBIM介面說明
- git 操作說明Git
- Oracle Latch 說明Oracle
- Oracle Namespace 說明Oraclenamespace
- 埠號說明