DBVERIFY
It is an external command-line utility that performs a physical data structure integrity check. It can be used on offline or online databases, as well on backup files.
You use DBVERIFY primarily when you need to ensure that a backup database (or datafile) is valid before it is restored, or as a diagnostic aid when you have encountered data corruption problems.
Overview:
- Verifying the table and tablespaces
- Checking the header block for the table
- Stimulating a corruption
- Recovering the block using RMAN
- Verifying using DATABASE BLOCK CORRUPTION
Step 1:
Verifying the TABLESPACE_NAME and its associated SEGMENT_NAME.
SQL> select SEGMENT_NAME,TABLESPACE_NAME from dba_segments where OWNER=’SCOTT’;
SEGMENT_NAME TABLESPACE_NAME
————— ——————————
SALGRADE USERS
DEPT USERS
EMP USERS
PK_DEPT USERS
PK_EMP USERS
Step 2:
By issuing the below command we can check the header block for the table ‘DEPT’
SELECT header_block FROM dba_segments WHERE segment_name=’DEPT’;
SQL> select file_name from dba_data_files;
FILE_NAME
/u01/app/oracle/oradata/ORACLE19C/datafile/o1_mf_users_j21snyfk_.dbf
/u01/app/oracle/oradata/ORACLE19C/datafile/o1_mf_undotbs1_j21snxbn_.dbf
/u01/app/oracle/oradata/ORACLE19C/datafile/o1_mf_system_j21skfkg_.dbf
/u01/app/oracle/oradata/ORACLE19C/datafile/o1_mf_sysaux_j21sn40n_.dbf
Step 3:
Command to corrupt the block ,
[oracle@oracle19c ~]$ dd of=/u01/app/oracle/oradata/ORACLE19C/datafile/o1_mf_users_j21snyfk_.dbf bs=8192 conv=notrunc seek=347 << EOF
corruption test
EOF
0+1 records in
0+1 records out
16 bytes (16 B) copied, 4.9494e-05 s, 323 kB/s
Step 4:
To flush the buffer cache we need to provide the below command
SQL> ALTER SYSTEM FLUSH BUFFER_CACHE;
System altered.
Step 5:
Selecting the corrupted table , but it shows error
Step 6:
Viewing the corrected block in the database
select * from V$DATABASE_BLOCK_CORRUPTION;
Step 7:
Command to verify the corrupted block across the datafile using the below command
dbv file=/u01/app/oracle/oradata/ORACLE19C/datafile/o1_mf_users_j21snyfk_.dbf blocksize=8192
Step 8:
Command to recover the block and datafile using RMAN,
The datafile and corrupted block we can check it in the previous step ‘DBVERIFY-DBV’ command
recover datafile 7 block 347;
Verification’s:
After recovering there are no rows found in database block corruption ,
And after issuing dbverify command ,there we can see the marked corruption is ‘0’
Thank you for giving your valuable time to read the above information.
If you want to be updated with all our articles send us the Invitation or Follow us:
Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter : https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8