Database Corruption Challenge #9 – How I Corrupted the Database.
I was asked how I caused the corruption in Database Corruption Challenge #9. Here is how I did it.
To cause the corruption, I used the undocumented DBCC WritePage, however the same thing could have been accomplished by detaching the database, opening it with a hex editor, and then re-attaching the db.
DBCC WritePage
WARNING: DBCC WritePage is a dangerous command, that should never be used on any production database. It may invalidate your ability to get support from Microsoft on issues that arise with that database going forward. It is not my intention to encourage anyone to use DBCC WritePage ever. This is just what I used to create a corrupt database, and since creating corrupt databases is not part of the role of most DBAs, you should not use DBCC WritePage. Consider yourself warned.
Read More »Database Corruption Challenge #9 – How I Corrupted the Database.