Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have to write a program that detects corrupted tables and tries to repair them. For this I need to corrupt tables regularly.

Is there anyway to corrupt tables manually?

share|improve this question

migrated from stackoverflow.com Jan 21 '12 at 19:03

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 3 down vote accepted

Paul Randal has several Sample corrupt databases to play with:

  • DemoDataPurity - 192-MB SQL Server 2005 database with a single 2570 (data purity) error

  • DemoFatalCorruption1 - 1-MB SQL Server 2005 database with a corrupt system table (that allows CHECKDB to complete)

  • DemoFatalCorruption2 - 1-MB SQL Server 2005 database with a corrupt system table (that terminates CHECKDB)

  • DemoNCIndex - 192-MB SQL Server 2005 database with a bunch of nonclustered index corruptions

  • DemoRestoreOrRepair - 1-MB SQL Server 2005 database with a page checksum failure (in fact a zero'd out page)

  • DemoCorruptMetadata - 1-MB SQL Server 2000 database with corrupt syscolumns table

Also, How to create a corrupt database using BULK INSERT/ UPDATE and BCP - SQL Server as a HEX editor.

share|improve this answer
    
Paul thanks for the database collection, but for testing i will be using our database. Thus i we need the tables of my database to be corrupt. Is there anyway to corrupt tables manually? –  Karthick M Mayan Jun 1 '11 at 10:30
    
@Karthick M Mayan: Sure is. Read that last linked article I posted. –  Mitch Wheat Jun 2 '11 at 5:17
    
Thanks Mitch. The article helped a lot. –  Karthick M Mayan Jun 2 '11 at 7:36

I don't actually know what makes a table corrupt, but since you'll be scanning for certain symptoms, you know that, right? So you could just open the database file in, say, a hex editor and modify the corresponding data, e.g. change a value representing the number of records to come or something like that?

share|improve this answer
    
thanks Nicolas for the suggestion. will try something of his sort. –  Karthick M Mayan Jun 1 '11 at 10:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.