Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to corrupt oracle block
Js wrote:
> Hi,
>
> I want to corrupt the oracle block for testing purpose on my test
> machine.
>
> Can one tall me how can we do this.
>
> I heard that we can do that using "dd" ...
>
> Please suggest.
>
> Regards,
> Js
Disclaimer severe damage may result. Make sure you have anything necessary backed up. Do not do this on a production system!
The best advice would be to open a tar with oracle and get them to supply info. But they won't do that ( at least easily ) when the subject is how to corrupt a block.
Then proceed carefully and do some queries to identify what block you want to wack!
The following script will ( perhaps ) work on a cooked file system.
> more corrupt.sh
#!/bin/ksh
FILE=${1:?'Parameter 1 should be set to file name'}
BLOCK=${2:?'Parameter 2 should be set to the block to be corrupted'}
dd of=$FILE bs=8192 conv=notrunc oseek=$BLOCK <<EOF
CORRUPT
EOF
You may have to do something a little differently on a raw partition
and perhaps adjust the seek value ( from what block oracle thinks it is
) ( varies by os and logical volume manager setup )
> more bad_block.sh
#!/bin/ksh
dd if=/home/oracle/badb13.dd of=/dev/vs_4/r_(fill_in_raw_partion)_.dbf
bs=8192 seek=13 count=1
> more badb13.dd
************************ (just a bunch of characters or whatever youwant ) **** Received on Fri Nov 11 2005 - 11:40:40 CST