Dealing with Database Corruption DBA 911
Who am I? 2 David M Maxwell twitter.com/dmmaxwell or twitter.com/upsearchsqltwitter.com/dmmaxwelltwitter.com/upsearchsql or dmmaxwell.wordpress.com or upsearch.comdmmaxwell.wordpress.comupsearch.com –Scripts / Slides available here. Visit and find your ideal way to stay in touch.
Agenda Definitions of Consistency and Corruption Planning and Practicing Errors to Watch For Sample Corruption Scenarios 3
What are Consistency and Corruption? Consistency is an ACID property of transactions. –ACID = Atomic, Consistent, Isolated, Durable –Consistent = Transactions must follow rules. Corruption is the loss of Consistency. Almost always an IO subsystem problem. Occasionally a software error. May be delayed, but not prevented. 4
Planning for Corruption Determine the appropriate SLA – then exceed it. Monitor for corruption with Agent jobs and alerts. Document and test your plan. –Consider multiple paths to restoring service. Test your backups. Practice regularly. 5
Corruption Situations in Practice Don’t panic. Communicate appropriately. Run CHECKDB – and let it finish. Examine all the output carefully. Take your plan one step at a time. Document everything. 6
Errors to Watch For 823 – Read Failure 824 – Page Checksum Failure –Requires CHECKSUM page verification. 825 – Read Retry –Logged as a Severity 10 error. Won’t be caught by most systems. 833 – In-Memory Checksum Failure –Far worse than Error – Data Purity Error –Value stored is outside the range of the datatype. –SQL Server cannot repair this. 7
Demonstrations DBCC Commands Data Purity Error Nonclustered Index Corruption Single Page Repair via Restore Repair with Data Loss 8
Resources SQL Server Books Online: CHECKDB – Paul Randal’s Blog – from-every-angle/ from-every-angle/ Ola Hallengren Maintenance Procs – Minionware: Minion CHECKDB –Currently in Open Beta Emergency Mode Repair Playtime – mode-repair-playtime/ mode-repair-playtime/ 9
Thanks! David M Maxwell twitter.com/dmmaxwell or twitter.com/upsearchsqltwitter.com/dmmaxwelltwitter.com/upsearchsql or dmmaxwell.wordpress.com or upsearch.comdmmaxwell.wordpress.comupsearch.com –Scripts / Slides available here. Visit and find your ideal way to stay in touch. 10