1

I have written scripts for database maintains plan

now i want to test my script

i dont have any currpted database then how can i belive my integirty check script giving right error message if my DB is corrpted

i want to corrpt my database to test this how to corrpt the databse :)

DBCC CHECKDB WITH NO_INFOMSGS; GO

Yogesh
  • 150
  • 1
  • 4
  • 20

3 Answers3

4

Paul Randal has some corrupted databases on the the SQL Skills site.

See www.sqlskills.com

http://www.sqlskills.com/blogs/paul/corruption-demo-databases-and-scripts/

Brian Knight
  • 4,970
  • 28
  • 34
1

For a possible test scenario, drop constraints and/or triggers, corrupt your data (i.e. set former-foreign key references to NULL) then see if your script detects the corruption.

matthudson
  • 182
  • 6
  • It is not possible to corrupt the database that way. SQL Server *never* allows it. Or maybe I misunderstood your definition of corrupt? – usr Jan 11 '13 at 16:06
  • its looks easy but difficult to implement this theory in practical still working on this didn't found any success – Yogesh Jan 11 '13 at 16:44
  • You can't drop constraints or triggers on SQL server? – matthudson Jan 11 '13 at 17:20
  • 1
    I consider broken relations to be corruption of my data integrity. I hope you do, too. But that's not the same as corruption of the memory or storage layer, which also threatens data integrity, but you didn't indicate that much. – matthudson Feb 05 '13 at 14:40
0

Get to the internal services and delete stuff that looks important. If that is not what you want then copy all the files onto a flash drive and repeatedly eject it incorrectly - eventually it will be corrupted. Then upload it back onto the server machine and check. But the likelihood is that your script will be corrupted

janisz
  • 6,292
  • 4
  • 37
  • 70