In a physical corruption, which is also called a media corruption, the database does not recognize the block at all the checksum is invalid, the block contains all zeros, or the header and footer of the block do not match.
In a logical corruption, the contents of the block are logically inconsistent. Examples of logical corruption include corruption of a row piece or index entry. If RMAN detects logical corruption, then it logs the block in the alert log and server session trace file.
By default, RMAN does not check for logical corruption. If you specify CHECK LOGICAL
on the BACKUP
command, however, then RMAN tests data and index blocks for logical corruption, such as corruption of a row piece or index entry, and log them in the alert log.
To findout the physical corruption Oracle provided us a utility called "DBVERIFY"
Example : $dbv file=dbv file=/u02/app/oracle/oradata/prod/krish01.dbf feedback=10000 blocksize=8192
incase if you are going to validate ASM files use
Example : $dbv userid=grid/grid file=dbv file=/u02/app/oracle/oradata/prod/krish01.dbf feedback=10000 blocksize=8192
the output will be like this :-
[oracle@oracle prod]$ dbv file=/u02/app/oracle/oradata/prod/krish01.dbf feedback=10000 blocksize=8192
DBVERIFY: Release 11.2.0.1.0 - Production on Tue Mar 18 11:57:21 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
DBVERIFY - Verification starting : FILE = /u02/app/oracle/oradata/prod/krish01.dbf
..
DBVERIFY - Verification complete
Total Pages Examined : 12160
Total Pages Processed (Data) : 10908
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 2
Total Pages Failing (Index): 0
Total Pages Processed (Other): 377
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 873
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 857052 (0.857052)
To find out the logical corruption we have two ways one is using RMAN and the other is validating the structure
Using RMAN
some examples for them :-
RMAN > backup validate check logical database; #This will do logical check database
RMAN > backup validate check logical database archivelog all; #This will do logial check for archives
RMAN > validate database;
RMAN > validate check logical database;
RMAN > validate datafile 1;
RMAN > validate check logical datafile 1;
RMAN > validate tablespace krishna;
RMAN > validate check logical tablespace krishna;
From SQL prompt :
Validate structure of the table for logical corruption
SQL > analyze table krish.test validate structre; # to analyze table for logical corruptions
SQL > analyze table krish.test validate structure cascade; # which include indexes too
Note : Detection of the block corruption depends upon the type of corruption it is
*interblock corruption : the corruption occurs between blocks and can only be logical.
*intrablock corruption : the corruption occurs within the block itself. This corruption can be either physical/logical.