Database Corruption
Advanced Recovery Techniques
Patrick Flynn
The Link Group
Data Platform Summit 2018 is a community initiative by eDominer Systems
Patrick Flynn MCM – SQL Server 2008
SQL Server DBA MCSM – Data Platform
Link Group Australia Group Production DBA for 10+ years.
[email protected]
@sqllensman
Patrick Flynn
Data Platform Summit 2018 is a community initiative by eDominer Systems
What we will cover:
• What is Database Corruption.
• What to do when Corruption is
found.
• Sample Corruption Scenarios
Data Platform Summit 2018 is a community initiative by eDominer Systems
What is Database Corruption
• Loss of Durability Property of
Transactions.
• Physical Corruption
• Logical Corruption
• Cannot be prevented!.
Data Platform Summit 2018 is a community initiative by eDominer Systems
When Corruption is found:
• Rule 1
• Don’t Panic. Have a Plan
• Rule 2
• Don’t Make things Worse.
• Rule 3
Data Platform Summit 2018 is a community initiative by eDominer Systems
Repair Options
• Restore from Backup
• Full, Page-Level, Piecemeal
• Requires working, tested Backups!!
• Replace using Redundant Copies of Data
• Check DB using Repair Rebuild
• Manual Correction of Corruption
• DBCC CHECKDB (REPAIR_ALLOW_DATA_LOSS)
• Should be Last Resort option
Data Platform Summit 2018 is a community initiative by eDominer Systems
TOOLS OF TRADE
Data Platform Summit 2018 is a community initiative by eDominer Systems
Structure of Page
Data Platform Summit 2018 is a community initiative by eDominer Systems
Page Structure at Byte Level
Data Record
Data Platform Summit 2018 is a community initiative by eDominer Systems
Tools of Choice
Hex Editors DBCC CHECKDB fn_dblog
DBCC PAGE
DBCC IND
sys.system_internals_partition_columns sys.fn_PhysLocFormatter
Data Platform Summit 2018 is a community initiative by eDominer Systems
Binary Translation of Data
• Use this layout to show software code
• The font is Consolas, a monospace font
• The slide doesn’t use bullets but levels can be indented using the
“Increase List Level” icon on the Home menu
Data Platform Summit 2018 is a community initiative by eDominer Systems
Aim is to avoid this Scenario
Data Platform Summit 2018 is a community initiative by eDominer Systems
CORRUPTION DEMOS
Data Platform Summit 2018 is a community initiative by eDominer Systems
In Summary
• Take Backups (and test them )
• Monitor for Corruption
• Checksum is your Friend
• Practice fixing corruption.
• Don’t Panic !
• For more information see Resources
pages
Data Platform Summit 2018 is a community initiative by eDominer Systems
Resources
• Steve Stedman Corruption Challenge
• http://stevestedman.com/category/corruption
• SQL Skills – Paul S Randal
• http://www.sqlskills.com/blogs/paul/category/checkdb-from-every-angle
• SQLSoldier - Robert Davis
• http://www.sqlsoldier.com/wp/tag/31daysofdisasterrecovery
• Minion Software – Backups and CheckDB
• http://minionware.net/backup
• http://minionware.net/checkdb
•
Data Platform Summit 2018 is a community initiative by eDominer Systems
Resources cont.
• ORCA MDF – Mark S Rasmussen
• http://improve.dk/category/SQL%20Server%20-%20OrcaMDF/
• Hex Editors
• http://xvi32.en.softonic.com/download
• https://mh-nexus.de/en/hxd/
• Pluralsight
• SQL Server: Detecting and Correcting Database Corruption
• SQL Server: Detecting and Recovering from Database Corruption
Data Platform Summit 2018 is a community initiative by eDominer Systems
A Big Thanks to Our Knowledge Partners
Data Platform Summit 2017
2018 is a community initiative by eDominer Systems
Thank you
for your time!
Post your pics with hash tag #DPS10 and win some cool prizes
Join DataPlatformGeeks community. www.DataPlatformGeeks.com
Data Platform Summit 2018 is a community imitative by eDominer Systems
Data Platform Summit 2018 is a community initiative by eDominer Systems