dbv,rman检查数据文件坏块

来源:互联网 发布:热电偶数据采集器 编辑:程序博客网 时间:2024/04/29 21:53

将users01.dbf用Ultraedit修改一下模拟坏块

1:使用dbv检查坏块

[oracle@ora11g ~]$ dbv file=/u01/app/oracle/oradata/orcl/users01.dbf blocksize=8192DBVERIFY: Release 11.2.0.3.0 - Production on Thu Sep 26 16:06:35 2013Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/orcl/users01.dbfPage 138 is marked corruptCorrupt block relative dba: 0x0100008a (file 4, block 138)Bad header found during dbv: Data in bad block: type: 0 format: 0 rdba: 0x01000000 last change scn: 0x0000.00000003 seq: 0x1 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x00033a01 check value in block header: 0x9db0 computed block checksum: 0xa2b0DBVERIFY - Verification completeTotal Pages Examined         : 640Total Pages Processed (Data) : 0Total Pages Failing   (Data) : 0Total Pages Processed (Index): 0Total Pages Failing   (Index): 0Total Pages Processed (Other): 638Total Pages Processed (Seg)  : 0Total Pages Failing   (Seg)  : 0Total Pages Empty            : 1Total Pages Marked Corrupt   : 1Total Pages Influx           : 0Total Pages Encrypted        : 0Highest block SCN            : 13795 (0.13795)

2:使用rman检查坏块

通过校验和字段进行检查叫物理一致性检查,其侧重于硬件故障,并不关心内容正确与否,而逻辑一致性检查便是接手这任务,如:记录和索引是否对应;记录是否被不存在的事务锁定等.

db_block_checksum:物理一致性检查,当值为true时,Oracle除了会对所有表空间的数据块进行校验和检查,还会对redo log块做校验和如果置之为false,则只会对system表空间的数据块进行校验,Oracle建议开启这个参数.

db_block_checking:逻辑一致性检查当值为false时,只会对system表空间做逻辑一致性检查对性能影响比较大,需DBA自己权衡.


物理一致性检查

RMAN> validate datafile 4;Starting validate at 26-SEP-13using channel ORA_DISK_1channel ORA_DISK_1: starting validation of datafilechannel ORA_DISK_1: specifying datafile(s) for validationinput datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbfchannel ORA_DISK_1: validation complete, elapsed time: 00:00:01List of Datafiles=================File Status Marked Corrupt Empty Blocks Blocks Examined High SCN---- ------ -------------- ------------ --------------- ----------4    OK     1              1            642             13795       File Name: /u01/app/oracle/oradata/orcl/users01.dbf  Block Type Blocks Failing Blocks Processed  ---------- -------------- ----------------  Data       0              0                 Index      0              0                 Other      0              639             Finished validate at 26-SEP-13

逻辑一致性检查

RMAN> VALIDATE CHECK LOGICAL DATAFILE 4;Starting validate at 26-SEP-13using channel ORA_DISK_1channel ORA_DISK_1: starting validation of datafilechannel ORA_DISK_1: specifying datafile(s) for validationinput datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbfchannel ORA_DISK_1: validation complete, elapsed time: 00:00:01List of Datafiles=================File Status Marked Corrupt Empty Blocks Blocks Examined High SCN---- ------ -------------- ------------ --------------- ----------4    OK     1              1            642             13795       File Name: /u01/app/oracle/oradata/orcl/users01.dbf  Block Type Blocks Failing Blocks Processed  ---------- -------------- ----------------  Data       0              0                 Index      0              0                 Other      0              639             Finished validate at 26-SEP-13

The VALIDATE command initiates data integrity checks, logging physical, and optionally logical, block corruptions of database files and backups in the V$DATABASE_BLOCK_CORRUPTION view and the Automatic Diagnostic Repository as one or more failures. The following code shows some of the possible syntax variations.

    # Check for physical corruption of all database files.    VALIDATE DATABASE;    # Check for physical and logical corruption of a tablespace.    VALIDATE CHECK LOGICAL TABLESPACE USERS;    # Check for physical and logical corruption of a datafile.    VALIDATE CHECK LOGICAL DATAFILE 4;    # Check for physical corruption of all archived redo logs files.    VALIDATE ARCHIVELOG ALL;    # Check for physical and logical corruption of the controlfile.    VALIDATE CHECK LOGICAL CURRENT CONTROLFILE;    # Check for physical and logical corruption of a specific backupset.    VALIDATE CHECK LOGICAL BACKUPSET 3;

The BACKUP VALIDATE and RESTORE VALIDATE commands perform the same checks as theVALIDATE command for the files targeted by the backup or restore command, but they don't actually perform the specified backup or restore operation. This allows you to check the integrity of a backup or restore operation before actually performing it. The following code shows some of the possible syntax variations.

# Check for physical corruption of files to be backed up.BACKUP VALIDATE DATABASE ARCHIVELOG ALL;# Check for physical and logical corruption of files to be backed up.BACKUP VALIDATE CHECK LOGICAL DATABASE ARCHIVELOG ALL;# Check for physical corruption of files to be restored.RESTORE VALIDATE DATABASE;# Check for physical and logical corruption of files to be restored.RESTORE VALIDATE CHECK LOGICAL DATABASE;