I have seen many people talking about the Database Verify(DBV) utility that it can be only used for the physical database check for any sort of corruptions( which is true too). That’s correct to say that the use of the DBV is to check (mandatorily) the data blocks so it can be used only to check the data files.
I have just got a question which did raise a doubt that somewhere its mentioned that the DBV can be “only” used to do the “logical corruption” check as well, how? Well, first of all , the statement itself is not correct. The DBV can be certainly used to check the physical corruption of a block and that’s what I believe most of us know about DBV as well too. So what about this logical corruption? Ain’t we suppose to use Flashback technology for it? Well, to answer these questions, we first of all have to understand what does it mean by “logical corruption” ?
First , what’s a physical corruption? It means that the underlying place where the block was sitting, itself is corrupted. The error normally would arise because of a faulty media or a bad sector over the media which essentially would physically corrupt the block, making it impossible for oracle to access it.And if you do find a block physically corrupted, the very first step before you attempt to recover the block would be that you replace the underlying media first. Once the media is replaced, the underlying block can be recovered using the Block Recover command (10g) or Recover command(11g) !
The perception that I have seen most of the times in my sessions is that when someone mentions “logical corruption”, he only means a DML corrupting data “logically” , for example all salaries getting updated to 0 by someone in one single Update command! Right? Wrong! This is not “logical corruption” but its “logical data corruption” and certainly for this, the Flashback technology is well verse to be used! So what the heck is the “logical corruption” of a block is ? Well, simply put and in the first place, the block is physically fine which means that the physical location where the block is located is perfectly fine and there are absolutely no issues for Oracle to read the block! But despite that, there is some inconsistency in the block which is making it marked as corrupted and that’s not related to the physical allocation of the block!
For example, if there is an index entry that should point to a data block, is found to be null i.e it stores an entry pointing to nowhere is an example of logical corruption of the block! The block would be fine in terms of physical aspects but still, its termed as corrupted “logically” by oracle! If there is a row entry mismatch found in the block, oracle reports internal error, ora-600 with the argument, [KDSGRP1], which means that there was a mismatch found in the row entries of the block. This kind of corruption would normally happen on its own and there are not set rules which would make it come! When you hit logical corruption, the block from Oracle’s side is completely fine and is fully accessible, yet the block is corrupted internally! This kind of corruption can be checked with the DBV command supplying it the information about the object whose blocks you want to verify. Obviously, this detection would be done below the high water mark of the segment, covering only those block which were formatted either now or in the past some time! The new or unformatted won’t have anything to do with the lgocial corruption!
To call DBV for the segment check, you need to pass minimally the user information (login credentials) of the user with the segment information which would comprise of the Tablespace Number, Relative file Number of the tablespace containing the block and the header block of the object! All this information can be picked up using the V$tablespace and dba_segments views. Other than that, in the Sys schema, you can find the view with the name Sys_user_segs which would also show the same to you! Shown below is a small snippet which is about creating an object and thus checking its information from both the views and finally using that info in the DBV command! Please note that the segment identification information passed in the command is comprising of the tablespace id, relative file number of the object and the header block of the object!
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - ProductionSQL> drop table e purge
2 ;Table dropped.
SQL> create table e as select * from scott.emp;
Table created.
SQL> exec dbms_stats.gather_table_stats(user,'E');
PL/SQL procedure successfully completed.
SQL> select segment_name, tablespace_name, header_file, header_block
2 from dba_segments
3 where segment_name='E';SEGMENT_NAME
-------------------------------------------------------------------------
TABLESPACE_NAME HEADER_FILE HEADER_BLOCK
------------------------------ ----------- ------------
E
USERS 4 395SQL> select ts#,name from v$tablespace where name='USERS';
TS# NAME
---------- ------------------------------
4 USERSSQL> exit
C:\>dbv userid=aman/aman segment_id=4.4.395
DBVERIFY: Release 11.1.0.6.0 - Production on Thu Mar 4 00:34:59 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY - Verification starting : SEGMENT_ID = 4.4.395
DBVERIFY - Verification complete
Total Pages Examined : 8
Total Pages Processed (Data) : 1
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 6
Total Pages Processed (Seg) : 1
Total Pages Failing (Seg) : 0
Total Pages Empty : 0
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 1094559 (0.1094559)C:\>
As you can see that there won’t be anything mentioned by the DBV that the corruption is due to a physical corruption or a logical corruption! That’s why, to be ensured, its better to use Rman’s validate command which can check the blocks for physical and logical corruption!
So what’s the conclusion? Well, the conclusion is that “logical data corruption” is not the same as “logical block corruption” and DBV is not meant for only checking the physical corruption of the blocks within the data file and can be used the blocks of a segment as well!
And all of this is documented( okay may be not all ) in the official documentation,
http://download.oracle.com/docs/cd/E11882_01/server.112/e10701/dbverify.htm#i1006970
Hope this helps 🙂 !

Hi,
Nice learning. 🙂
Just one change is required in the conclusion part
“Well, the conclusion is that “logical corruption” is not the same as “logical data corruption” ”
Regards,
Anand
Aah thanks Anand for pointing it out :-). I shall edit it right away.
Cheers
Aman….
Hi Aman,
Once again Excellent explaination.I have one question
1)How do we obtain SEGMENT_ID ?
Thanks,
Rafi.
Hi
Hi Aman,
great explanation as always. I enjoy reading your blog articles and forum posts.
Keep on with good work 😉
Regards,
Marko
Hi Marko,
Thanks a bunch for stopping by here and for the kind words 🙂 . I don’t know much, its just few bits and bytes from here and there but glad to see that its helpful at times too 🙂 . Congrats for your certification 🙂 .
Regards
Aman….
Hi Rafi,
Thanks for stopping by here and for the kind words 🙂 . You can get the segment_id most simply from sys_user_segs or from dba_extents.
Cheers
Aman….
Too late on tonight I just read about Block corruption and practise it.at the same time ,I have appeared in my mind, logical corruption ok.but What is logical data block corruption?,Well,I got a answer from your blogs.Thanks,Nice explanation.
Azar,
Glad to hear that you got benefited from this post!
Cheers
Aman….
Hi,
Sir detailed explanation i understood well the concepts but as u have mentioned abt physical corruption as well a how to resolve it i mean by changing the media …
what for logical corruption ??
Thanks in Advance
Regards
Kavita
Kavita,
Logical corruption is as what it says, logical. This is based on the troubles which are created by the user, for example, a wrong update. There is nothing what you can do from your side about it.
HTH
Aman….
Hi,
Sir thanks for your immediate response ….
this is based on the troubles which are created by the user, for example, a wrong update…… this is logical data corruption i was asking u for logical block corruption i know through rman we can chk that …..
but is there any way to repair it as in case of physical
Sir pls correct me if am wrong or u were mentioning of wrong update of index entry
Regards
Kavita
Hi Aman,
Good article – except in the above example if you can modify the e.g. segment_id=4.4.395
to say 6.4.395 it will be clearer – as the 4.4 will not give the reader (especially a new comer) which 4 is referring to what.
Thanks for your explanation guy’s i like it ..this is good article…Bunch for stopping by here and for the kind word ….Thank you:)
When is use dbv utility against other files in my db it works fine but when I use it against mentioned below data file it remains in running state never showing the result for that particular file.
Hi Aman – Great job! I’ve learned a lot from your post. I guess this problem is what I’m having after encountering several wrong updates. I think I need to be more careful next time.