Home » RDBMS Server » Backup & Recovery » Routine to corrupt a block (11.2.0.2 Unix/Windows)
Routine to corrupt a block [message #515969] Thu, 14 July 2011 05:51 Go to next message
John Watson
Messages: 4522
Registered: January 2010
Location: Global Village
Senior Member
Does anyone have a repeatable technique for damaging a datafile block?
I need to demonstrate and contrast various recovery techniques, such as dbms_repair, RMAN block recovery, and Data Guard automatic block repair.
Ideally, I'll end up with a shell script (or batch file) where I can enter a file number and block number, and wipe out that block.
Thanks for any suggestions.
Re: Routine to corrupt a block [message #515983 is a reply to message #515969] Thu, 14 July 2011 06:34 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10621
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
dd should work.
Something like this
http://orafaq.com/usenet/comp.databases.oracle.server/2005/11/11/0853.htm
Re: Routine to corrupt a block [message #515991 is a reply to message #515983] Thu, 14 July 2011 07:16 Go to previous messageGo to next message
John Watson
Messages: 4522
Registered: January 2010
Location: Global Village
Senior Member
Thanks, this works:

#!/bin/ksh
# script to damage a block, for testing block repair routine
# assumes 16k blocksize
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=16384 conv=notrunc oseek=$BLOCK

I execute this script, reading in some junk from STDIN:

$HOME/corrupt.sh o1_mf_mars_dat_7vsfhfqx_.dbf 13140 < junk.txt

and the block is broken.

ps - I did try to search the forum before asking for help! Really! I was getting Quote:
Too many concurrent search requests. Please try again later.
Re: Routine to corrupt a block [message #516011 is a reply to message #515991] Thu, 14 July 2011 09:03 Go to previous message
Mahesh Rajendran
Messages: 10621
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
I don't think the default search on OraFAQ would have pointed to this page.
This is from CDOS archives hosted in OraFAQ which I got from Google. Smile I know dd will work, was just looking for examples.
Previous Topic: Delete obsolete backups using rman
Next Topic: Learning RMAN, requesting initfile during startup DB
Goto Forum:
  


Current Time: Mon Sep 01 17:13:27 CDT 2014

Total time taken to generate the page: 0.10386 seconds