我们备份的数据文件,可以通过oacle自带的dbv工具来查看是否是好的。
下面实验如下:
环境:oracle10.2.0.1
1.检查数据文件是否有坏块
[oracle@app orcl]$ dbv DBVERIFY: Release 10.2.0.1.0 - Production on Fri Nov 22 20:59:01 2013 Copyright (c) 1982, 2005, Oracle. All rights reserved. Keyword Description (Default) ---------------------------------------------------- FILE File to Verify (NONE) START Start Block (First Block of File) END End Block (Last Block of File) BLOCKSIZE Logical Block Size (8192) LOGFILE Output Log (NONE) FEEDBACK Display Progress (0) PARFILE Parameter File (NONE) USERID Username/Password (NONE) SEGMENT_ID Segment ID (tsn.relfile.block) (NONE) HIGH_SCN Highest Block SCN To Verify (NONE) (scn_wrap.scn_base OR scn)
[oracle@app orcl]$ dbv file=users01.dbf feedback=100 DBVERIFY: Release 10.2.0.1.0 - Production on Fri Nov 22 21:01:11 2013 Copyright (c) 1982, 2005, Oracle. All rights reserved. DBVERIFY - Verification starting : FILE = users01.dbf ....... DBVERIFY - Verification complete Total Pages Examined : 640 Total Pages Processed (Data) : 25 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 2 Total Pages Failing (Index): 0 Total Pages Processed (Other): 32 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 581 Total Pages Marked Corrupt : 0 Total Pages Influx : 0 Highest block SCN : 1377014 (0.1377014)
主要关注Total Pages Failing (Seg) : 0 --------这一行
2.检查segment是否有坏块
SQL> desc sys_dba_segs Name Null? Type ----------------------------------------- -------- ---------------------------- OWNER VARCHAR2(30) SEGMENT_NAME VARCHAR2(81) PARTITION_NAME VARCHAR2(30) SEGMENT_TYPE VARCHAR2(18) SEGMENT_TYPE_ID NUMBER TABLESPACE_ID NUMBER TABLESPACE_NAME VARCHAR2(30) BLOCKSIZE NUMBER HEADER_FILE NUMBER HEADER_BLOCK NUMBER BYTES NUMBER BLOCKS NUMBER EXTENTS NUMBER INITIAL_EXTENT NUMBER NEXT_EXTENT NUMBER MIN_EXTENTS NUMBER MAX_EXTENTS NUMBER PCT_INCREASE NUMBER FREELISTS NUMBER FREELIST_GROUPS NUMBER RELATIVE_FNO NUMBER BUFFER_POOL_ID NUMBER SEGMENT_FLAGS NUMBER SEGMENT_OBJD NUMBER SQL> col segment_name format a30 SQL> select segment_name,tablespace_id,header_file,header_block from sys_dba_segs where owner='YN'; SEGMENT_NAME TABLESPACE_ID HEADER_FILE HEADER_BLOCK ------------------------------ ------------- ----------- ------------ FRUIT 4 4 59 SQL>
[oracle@app orcl]$ dbv userid=system/yn segment_Id=4.4.59 DBVERIFY: Release 10.2.0.1.0 - Production on Fri Nov 22 21:05:05 2013 Copyright (c) 1982, 2005, Oracle. All rights reserved. DBVERIFY - Verification starting : SEGMENT_ID = 4.4.59 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 Highest block SCN : 1377014 (0.1377014) [oracle@app orcl]$
注:其中的segment_Id=4.4.59 是通过上面sql查询出来的。
另外:dbv只能检查数据文件。