dbvrify的用法
dbvrify是用来检查数据文件,数据块,数据段的完整性的工具,示例如下:
$ dbv file=/home/db/oracle/oradata/testdb/tbs01.dbf feedback=10000
DBVERIFY: Release 10.2.0.1.0 - Production on Sun Aug 2 23:18:47 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = /home/db/oracle/oradata/testdb/tbs01.dbf
....................................................
DBVERIFY - Verification complete
Total Pages Examined : 512000
Total Pages Processed (Data) : 685
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 31
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 511284
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 1604431 (0.1604431)
通过上面的参数可以看到这个数据文件的属性,如果有坏块,也会显示在上面的输出中。
还可以通过dbvrify工具检查数据段的完整性,例如
dbv userid=test/test segment_id=6.5.11
具体讲解一下这个命令,userid是指该段的owner,而segment_id是由表空间编号(tsn),段的头文件编号(segfile),段的头块(segblock)组合而成
怎么查到这些值呢,可以通过sys_user_segs或者sys_dba_segs来获得,如下
SQL> l
1* select owner,segment_name,TABLESPACE_ID,HEADER_FILE,HEADER_BLOCK from sys_dba_segs where owner='TEST'
SQL> /
OWNER SEGMENT_NAME TABLESPACE_ID HEADER_FILE HEADER_BLOCK
-------------------- ---------------------------------------- ------------- ----------- ------------
TEST TEST 6 5 11
可以看到相应的值是6.5.11,执行这个命令后输出如下
$ dbv userid=test/test segment_id=6.5.11
DBVERIFY: Release 10.2.0.1.0 - Production on Sun Aug 2 23:22:54 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
DBVERIFY - Verification starting : SEGMENT_ID = 6.5.11
DBVERIFY - Verification complete
Total Pages Examined : 768
Total Pages Processed (Data) : 684
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 19
Total Pages Processed (Seg) : 1
Total Pages Failing (Seg) : 0
Total Pages Empty : 64
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Highest block SCN : 1604431 (0.1604431)
可以看到这个段总共有768个块,通过user_segments这个视图来验证一下
1* select segment_name,blocks from user_segments where segment_name='TEST'
SQL> .
SQL> /
SEGMENT_NAME BLOCKS
---------------------------------------- ----------
TEST 768
可以看到blocks也是768
阅读(649) | 评论(0) | 转发(0) |