Oracle's DBV Tools

Source: Internet
Author: User
Tags dba reserved

DBV (dbverify) is a command-line tool provided by Oracle that can check both physical and logical consistency of data files. However, this tool does not check the matching relationship of index records and data records, which must use the Analyze Validate structure command.

The work has the following characteristics:

    • Opens the data file in a read-only manner and does not modify the contents of the data file during the check process.

    • Data files can be checked online without having to close the database.

    • Control files and log files cannot be inspected, only data files can be inspected.

    • This tool can check ASM files, but the database must be open and users need to be specified via userid, such as: dBV file=+dg1/orcl/datafile/system01.dbf Userid=system/sys

    • On many UNIX platforms, DBV requires that the data file have an extension, if there is no way to establish a link, then to the linked method, and then to the linked file, such as: Ls-n/dev/rdsk/mydevice/tmp/mydevice.dbf

    • Some platforms, DBV tool can not check more than 2GB files, if encountered DBV-100 error, please check the file size, MOS Bug 710888 has a description of the problem.

    • DBV only checks the data block for correctness, but does not relate to which object the data block belongs to.

    • For naked devices It is recommended that you specify the end parameter to avoid exceeding the data file range. For example: dBV file=/dev/rdsk/r1.dbf end=<last_block_number>. The end value can be obtained by dividing the bytes field by the block size in the V$datafile view.

Parameters Meaning Default value
FILE The data file name to check No default value
START Check the starting data block number First block of data file
END Check the last data block number Last data block of the data file
BLOCKSIZE Data block size, this value is consistent with the database's db_block_size parameter values Default Value 8192
LOGFILE Check the result log file No default value
Feedbak Show progress 0
Parfile Parameter file name No default value
Userid User name, password No default value
segment_id Segment ID, parameter format <tsn.segfile.segblock> No default value

Examples of Use:

[[email protected] ~]$ dbv file=/u01/app/oracle/oradata/test/users01.dbfdbverify:  release 11.2.0.1.0 - production on mon may 22 16:42:26  2017copyright  (c)  1982, 2009, oracle and/or its affiliates.  all  rights reserved. dbverify - verification starting : file = /u01/app/oracle/oradata/test/ users01.dbfdbverify - verification completetotal pages examined          : 155520Total Pages Processed  (Data)  :  144530total pages failing    (Data)  : 0Total Pages Processed  (index): 52total pages failing    (index):  0total pages processed   (Other): 1248total pages processed  (Seg)   : 0Total Pages  failing    (Seg)   : 0Total Pages Empty             : 9690Total Pages Marked Corrupt   :  0total pages influx           : 0total  pages encrypted        : 0highest block scn             : 3559792  (0.3559792)

This tool reports the use of the page as the unit, meaning the same as the data block. From the above check results total Pages Marked corrupt:0 can see that the file does not have a bad block.

In addition to checking the data file, this tool also allows checking for individual segment, when the parameter value is in the format <tsn.segfile.segblock>

To view the Tsn,segfile,segblock properties of an object:

[Email protected]>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

The feasible parameter value from the above query result is 4.4.45834. Check segment:

[[email protected] ~]$ dbv userid=system/123456 segment_id=4.4.45834dbverify:  release 11.2.0.1.0 - production on mon may 22 20:58:33  2017copyright  (c)  1982, 2009, oracle and/or its affiliates.  all  rights reserved. dbverify - verification starting : segment_id = 4.4.45834dbverify -  Verification completeTotal Pages Examined          : 8Total Pages Processed  (Data)  : 5Total Pages Failing     (Data)  : 0Total Pages Processed  (Index): 0total pages  failing    (Index): 0total pages processed  (other):  2total pages  Processed  (SEG)   : 1Total Pages Failing    (SEG)    :  0total pages empty            :  0total pages marked corrupt   : 0total pages influx            : 0Total Pages Encrypted         : 0Highest block SCN             : 3518579  (0.3518579)

The following man creates a bad block, which is checked with DBV.

Create a test table

[Email protected]>create table bbed (ID number,name varchar2) tablespace users; Table created. [email protected]>insert into bbed values (1, ' Zhaoxu '); 1 row created. [Email protected]>commit; Commit complete.

The current data file does not have a bad block

[[email protected] ~]$ dbv file=/u01/app/oracle/oradata/test/users01.dbfdbverify:  release 11.2.0.1.0 - production on mon may 22 21:03:40  2017copyright  (c)  1982, 2009, oracle and/or its affiliates.  all  rights reserved. dbverify - verification starting : file = /u01/app/oracle/oradata/test/ users01.dbfdbverify - verification completetotal pages examined          : 155520Total Pages Processed  (Data)  :  66397total pages failing    (Data)  : 0Total Pages Processed  ( Index): 52total pages failing    (index):  0total pages processed   (Other): 88898total pages processed  (Seg)   : 0Total Pages  failing    (Seg)   : 0Total Pages Empty             : 173Total Pages Marked Corrupt   :  0total pages influx           : 0total  pages encrypted        : 0highest block scn             : 3764775  (0.3764775)

Get table storage information in a file

[Email protected]>set serveroutput on[email protected]>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 RIDs 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); Ten Dbms_output.put_line (rfno| | ', ' | | blkno| | ', ' | | ROWNO); one end; 12/4,45844,0pl/sql procedure successfully completed.

modifying block information with bbed

[[email protected] bbed]$ bbed parfile=bbed.parpassword: bbed: release  2.0.0.0.0 - limited production on mon may 22 21:17:18  2017copyright  (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:0 x0100b314------------------------------------------------------------------------ 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:0 x0100b314------------------------------------------------------- 7a68616f 78750106 5873               l zhaoxu. Xs <16 bytes per line>bbed> modify 100 dba 4,45844warning:  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:0 x0100b314------------------------------------------------------------------------ 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:0 x0100b314------------------------------------------------------- 6468616f 78750106 5873               l dhaoxu. Xs <16 bytes per line>bbed> exit

Check files with dBV again

[[email protected] bbed]$ dbv file=/u01/app/oracle/oradata/test/users01.dbfdbverify:  release 11.2.0.1.0 - production on mon may 22 21:18:46  2017copyright  (c)  1982, 2009, oracle and/or its affiliates.  all  rights reserved. dbverify - verification starting : file = /u01/app/oracle/oradata/test/ users01.dbfpage 45844 is marked corruptcorrupt block relative dba:  0x0100b314  (file 4, block 45844) BAD&NBSP;CHECK&NBSP;VALUE&NBSP;FOUND&NBSP;DURING&NBSP;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:  0x1edbverify - verification completetotal pages examined          : 155520Total Pages Processed  (Data)  : 66396total  Pages Failing    (Data)  : 0Total Pages Processed  (Index):  52Total Pages Failing    (Index): 0total pages processed  ( Other): 88898total pages processed  (Seg)   : 0total pages failing     (Seg)   : 0Total Pages Empty             : 173total pages marked corrupt   :  1Total Pages Influx           :  0total pages encrypted        : 0highest block scn             : 3764775  (0.3764775)

Report a bad block, total Pages Marked corrupt:1
Query the test table again:

[Email Protected]>select * from Zx.bbed;id NAME----------------------------------------------------------------- -----1 Zhaoxu

The query is normal because the block is cached in Buffer_cache and the block in the file is modified. Two blocks are now inconsistent, and the test table is queried again after emptying the buffer cache.

[Email protected]>alter system flush Buffer_cache; System altered. [Email Protected]>select * from Bbed;select * from bbed *error to line 1:ora-01578:oracle data block Corr upted (File # 4, Block # 45844) ora-01110:data file 4: '/U01/APP/ORACLE/ORADATA/TEST/USERS01.DBF '

The query reported error ORA-01578.

Use DBV to check the data files in the ASM file, you need to specify the UserID parameter

[[email protected] ~]$ dbv file=+data/orcl/datafile/users.259.925306091 userid=sys/ 123456dbverify: release 11.2.0.4.0 - production on mon may 22  16:48:22 2017copyright  (c)  1982, 2011, oracle and/or its affiliates.   all rights reserved. dbverify - verification starting : file = +data/orcl/datafile/ users.259.925306091dbverify - verification completetotal pages examined          : 640Total Pages Processed  (Data)  :  16total pages failing    (Data)  : 0Total Pages Processed  ( Index): 2total pages failing    (index):  0total pages processed   (Other): 593total pages processed  (Seg)   : 0total pages failing    (Seg)   : 0Total Pages Empty             : 29Total Pages Marked Corrupt    : 0total pages influx           :  0total pages encrypted        : 0highest block  SCN            : 0  (0.0)


Reference: "Oracle RAC"

MOS document: Document ID 35512.1

This article is from the "DBA fighting!" blog, so be sure to keep this source http://hbxztc.blog.51cto.com/1587495/1928381

Oracle's DBV Tools

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.