DBV(DBVERIFY)是Oracle提供的一個(gè)命令行工具,它可以對(duì)數(shù)據(jù)文件物理和邏輯兩種一致性檢查。但是這個(gè)工具不會(huì)檢查索引記錄和數(shù)據(jù)記錄的匹配關(guān)系,這種檢查必須使用analyze validate structure命令。
創(chuàng)新互聯(lián)公司-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比十堰鄖陽(yáng)網(wǎng)站開(kāi)發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫(kù),直接使用。一站式十堰鄖陽(yáng)網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋十堰鄖陽(yáng)地區(qū)。費(fèi)用合理售后完善,10年實(shí)體公司更值得信賴。這個(gè)工具有如下特點(diǎn):
以只讀的方式打開(kāi)數(shù)據(jù)文件,在檢查過(guò)程中不會(huì)修改數(shù)據(jù)文件的內(nèi)容。
可以在線檢查數(shù)據(jù)文件,而不需要關(guān)閉數(shù)據(jù)庫(kù)。
不能檢查控制文件和日志文件,只能檢查數(shù)據(jù)文件。
這個(gè)工具可以檢查ASM文件,但數(shù)據(jù)庫(kù)必須Open狀態(tài),并且需要通過(guò)USERID指定用戶,比如:dbv file=+DG1/ORCL/datafile/system01.dbf userid=system/sys
在許多UNIX平臺(tái)下,DBV要求數(shù)據(jù)文件有擴(kuò)展名,如果沒(méi)有可以通過(guò)建立鏈接的方法,然后對(duì)鏈接的方法,然后對(duì)鏈接文件進(jìn)行操作,比如:ls -n /dev/rdsk/mydevice /tmp/mydevice.dbf
某些平臺(tái),DBV工具不能檢查超過(guò)2GB的文件,如果碰到DBV-100錯(cuò)誤,請(qǐng)先檢查文件大小,MOS Bug 710888對(duì)這個(gè)問(wèn)題有描述。
DBV只會(huì)檢查數(shù)據(jù)塊的正確性,但不會(huì)關(guān)系數(shù)據(jù)塊是否屬于哪個(gè)對(duì)象。
對(duì)于祼設(shè)備建議指定END參數(shù),避免超出數(shù)據(jù)文件范圍。比如:dbv FILE=/dev/rdsk/r1.dbf END=<last_block_number>。可以在v$datafile視圖中用bytes字段除以塊大小來(lái)獲得END值。
參數(shù) | 含義 | 缺省值 |
FILE | 要檢查的數(shù)據(jù)文件名 | 沒(méi)有缺省值 |
START | 檢查起始數(shù)據(jù)塊號(hào) | 數(shù)據(jù)文件的第一個(gè)數(shù)據(jù)塊 |
END | 檢查的最后一個(gè)數(shù)據(jù)塊號(hào) | 數(shù)據(jù)文件的最后一個(gè)數(shù)據(jù)塊 |
BLOCKSIZE | 數(shù)據(jù)塊大小,這個(gè)值要和數(shù)據(jù)庫(kù)的DB_BLOCK_SIZE參數(shù)值一致 | 缺省值8192 |
LOGFILE | 檢查結(jié)果日志文件 | 沒(méi)有缺省值 |
FEEDBAK | 顯示進(jìn)度 | 0 |
PARFILE | 參數(shù)文件名 | 沒(méi)有缺省值 |
USERID | 用戶名、密碼 | 沒(méi)有缺省值 |
SEGMENT_ID | 段ID,參數(shù)格式<tsn.segfile.segblock> | 沒(méi)有缺省值 |
使用示例:
[oracle@rhel6 ~]$ dbv file=/u01/app/oracle/oradata/test/users01.dbf DBVERIFY: Release 11.2.0.1.0 - Production on Mon May 22 16:42:26 2017 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/test/users01.dbf DBVERIFY - Verification complete Total Pages Examined : 155520 Total Pages Processed (Data) : 144530 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 52 Total Pages Failing (Index): 0 Total Pages Processed (Other): 1248 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 9690 Total Pages Marked Corrupt : 0 Total Pages Influx : 0 Total Pages Encrypted : 0 Highest block SCN : 3559792 (0.3559792)這個(gè)工具報(bào)告使用的是page作為單位,含義和data block相同。從上面的檢查結(jié)果Total Pages Marked Corrupt : 0可以看出文件沒(méi)有壞塊。
除了檢查數(shù)據(jù)文件,這個(gè)工具還允許檢查單獨(dú)的Segment,這時(shí)參數(shù)值的格式為<tsn.segfile.segblock>
查看對(duì)象的tsn,segfile,segblock屬性:
zx@TEST>select t.ts#,s.header_file,s.header_block 2 from v$tablespace t,dba_segments s 3 where s.segment_name='T' 4 and t.name=s.tablespace_name; TS# HEADER_FILE HEADER_BLOCK ---------- ----------- ------------ 4 4 45834從上面的查詢結(jié)果可行參數(shù)值為4.4.45834。檢查Segment:
[oracle@rhel6 ~]$ dbv userid=system/123456 segment_id=4.4.45834 DBVERIFY: Release 11.2.0.1.0 - Production on Mon May 22 20:58:33 2017 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. DBVERIFY - Verification starting : SEGMENT_ID = 4.4.45834 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 Total Pages Encrypted : 0 Highest block SCN : 3518579 (0.3518579)下面人為創(chuàng)造一個(gè)壞塊,用dbv來(lái)檢查。
創(chuàng)建一個(gè)測(cè)試表
zx@TEST>create table bbed (id number,name varchar2(20)) tablespace users; Table created. zx@TEST>insert into bbed values(1,'zhaoxu'); 1 row created. zx@TEST>commit; Commit complete.當(dāng)前數(shù)據(jù)文件沒(méi)有壞塊
[oracle@rhel6 ~]$ dbv file=/u01/app/oracle/oradata/test/users01.dbf DBVERIFY: Release 11.2.0.1.0 - Production on Mon May 22 21:03:40 2017 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/test/users01.dbf DBVERIFY - Verification complete Total Pages Examined : 155520 Total Pages Processed (Data) : 66397 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 52 Total Pages Failing (Index): 0 Total Pages Processed (Other): 88898 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 173 Total Pages Marked Corrupt : 0 Total Pages Influx : 0 Total Pages Encrypted : 0 Highest block SCN : 3764775 (0.3764775)獲取表在文件中的存儲(chǔ)信息
zx@TEST>set serveroutput on zx@TEST>declare rfno number; 2 rtype number; 3 ono number; 4 blkno number; 5 rowno number; 6 rid varchar2(30); 7 begin 8 select rowid into rid from bbed; 9 dbms_rowid.rowid_info(ROWID_IN=>rid,RELATIVE_FNO=>rfno,BLOCK_NUMBER=>blkno,ROW_NUMBER=>rowno,ROWID_TYPE=>rtype,OBJECT_NUMBER=>ono); 10 dbms_output.put_line(rfno||','||blkno||','||rowno); 11 end; 12 / 4,45844,0 PL/SQL procedure successfully completed.使用bbed修改塊信息
[oracle@rhel6 bbed]$ bbed parfile=bbed.par Password: BBED: Release 2.0.0.0.0 - Limited Production on Mon May 22 21:17:18 2017 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. ************* !!! For Oracle Internal Use only !!! *************** BBED> set dba 4,45844 DBA 0x0100b314 (16823060 4,45844) BBED> find /c zhaoxu File: /u01/app/oracle/oradata/test/users01.dbf (4) Block: 45844 Offsets: 8182 to 8191 Dba:0x0100b314 ------------------------------------------------------------------------ 7a68616f 78750106 5873 <32 bytes per line> BBED> dump /v dba 4,45844 offset 8182 count 32 File: /u01/app/oracle/oradata/test/users01.dbf (4) Block: 45844 Offsets: 8182 to 8191 Dba:0x0100b314 ------------------------------------------------------- 7a68616f 78750106 5873 l zhaoxu..Xs <16 bytes per line> BBED> modify 100 dba 4,45844 Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y File: /u01/app/oracle/oradata/test/users01.dbf (4) Block: 45844 Offsets: 8182 to 8191 Dba:0x0100b314 ------------------------------------------------------------------------ 6468616f 78750106 5873 <32 bytes per line> BBED> dump /v dba 4,45844 offset 8182 count 32 File: /u01/app/oracle/oradata/test/users01.dbf (4) Block: 45844 Offsets: 8182 to 8191 Dba:0x0100b314 ------------------------------------------------------- 6468616f 78750106 5873 l dhaoxu..Xs <16 bytes per line> BBED> exit再次使用dbv檢查文件
[oracle@rhel6 bbed]$ dbv file=/u01/app/oracle/oradata/test/users01.dbf DBVERIFY: Release 11.2.0.1.0 - Production on Mon May 22 21:18:46 2017 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/test/users01.dbf Page 45844 is marked corrupt Corrupt block relative dba: 0x0100b314 (file 4, block 45844) Bad check value found during dbv: Data in bad block: type: 6 format: 2 rdba: 0x0100b314 last change scn: 0x0000.00397358 seq: 0x1 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x73580601 check value in block header: 0x7c2d computed block checksum: 0x1e DBVERIFY - Verification complete Total Pages Examined : 155520 Total Pages Processed (Data) : 66396 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 52 Total Pages Failing (Index): 0 Total Pages Processed (Other): 88898 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 173 Total Pages Marked Corrupt : 1 Total Pages Influx : 0 Total Pages Encrypted : 0 Highest block SCN : 3764775 (0.3764775)報(bào)告一個(gè)壞塊,Total Pages Marked Corrupt : 1
再次查詢測(cè)試表:
查詢正常,因?yàn)樵赽uffer_cache中緩存了塊,而修改的是文件中的塊。兩個(gè)塊現(xiàn)在不一致,清空buffer cache后再次查詢測(cè)試表。
zx@TEST>alter system flush buffer_cache; System altered. zx@TEST>select * from bbed; select * from bbed * ERROR at line 1: ORA-01578: ORACLE data block corrupted (file # 4, block # 45844) ORA-01110: data file 4: '/u01/app/oracle/oradata/test/users01.dbf'查詢報(bào)出錯(cuò)誤ORA-01578。
使用dbv檢查ASM文件中的數(shù)據(jù)文件,需要指定userid參數(shù)
[oracle@rac1 ~]$ dbv file=+DATA/orcl/datafile/users.259.925306091 userid=sys/123456 DBVERIFY: Release 11.2.0.4.0 - Production on Mon May 22 16:48:22 2017 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. DBVERIFY - Verification starting : FILE = +DATA/orcl/datafile/users.259.925306091 DBVERIFY - Verification complete Total Pages Examined : 640 Total Pages Processed (Data) : 16 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 2 Total Pages Failing (Index): 0 Total Pages Processed (Other): 593 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 29 Total Pages Marked Corrupt : 0 Total Pages Influx : 0 Total Pages Encrypted : 0 Highest block SCN : 0 (0.0)參考:《大話Oracle RAC》
MOS文檔:文檔 ID 35512.1
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
網(wǎng)站名稱:Oracle的DBV工具-創(chuàng)新互聯(lián)
分享網(wǎng)址:http://m.newbst.com/article14/cosege.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、App設(shè)計(jì)、網(wǎng)站內(nèi)鏈、靜態(tài)網(wǎng)站、關(guān)鍵詞優(yōu)化、營(yíng)銷型網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容