The below command is showing how to corrupt an oracle block for the purpose of testing the RMAN block recovery features.
First, I should find a block that will be corrupted. For this, I am using below sql.
SQL> select a.file_name,d.header_block, d.blocks
FILE_NAME HEADER_BLOCK BLOCKS
Here you should not corrupt the header block 1 because RMAN cannot perform block level recovery on 1th block (datafile header) of the datafile.
For example I want to corrupt 15th block of mytbs01.dbf:
$ dd if=/dev/zero of=/u02/oracle/oradata/ORCL/mytbs01.dbf bs=8k conv=notrunc seek=15 count=1;
1+0 records in
Let’s verify corrupted block:
$ dbv file=/u02/oracle/oradata/ORCL/mytbs01.dbf blocksize=8192
DBVERIFY – Verification starting : FILE = /u02/oracle/oradata/ORCL/mytbs01.dbf
DBVERIFY – Verification complete
Total Pages Examined : 6400