Create DBCC Error

  • This sounds like a strange question but I am trying to determine how I can cause corruption in my database.  I am trying to teach a coworker how to diagnose and then fix dbcc errors but it would be easier if I could cause some for him to fix.

    Thanks in advance

  • I'm not sure if this will work, but you might be able to edit the data in a backup file and restore it.  You could modify a table to contain a duplicate key, for example. 

    I've seen it done, but never tried it myself.

    This is fairly simple:  Insert some data somewhere that is easily recognizable, Back up a database, then open the backup file in a (binary safe) editor.  You can locate the recognizable data in the editor and then make some changes, specifically changes that would violate integrity.

    Then restore the database and you have corruption.

    jg

  • Thanks it worked great.  It gave me a corrupt table and after I ran a RAISERROR I was able to duplicate the info in the sql error log.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply