Database Corruption and Recovery | SansSQL

Tuesday, September 11, 2012

Database Corruption and Recovery

What is database corruption?
Inconsistency in the internal structure of the database with respect to data or log files is known as database corruption

What causes database Corruption?
  • Physical Inconsistency - One or more access paths to the data may be invalid.
  • Logical Inconsistency  - One or more pointers to the data may be invalid

How to detect Corruption?
  • Status of database set to “suspect”
  • Evident from Error log and/or Event Viewer logs
  • Consistency errors from DBCC CHECKDB
  • T-SQL Queries or application throwing corruption related error (Database might be online without being suspect)
  • SQL Server Startup Failure
  • Failure while Restoring or Attaching databases

What are the causes that leads to database corruption?
  • Hardware failure event
    • Power outage
    • SAN crash
    • NTFS or File System Corruption
    • FTDisk Errors
    • Bad Block or Disk Corruption
    • Outdated  or Faulty Drivers
  • Failed Restore/Attach
    • Due to Bad File/Page
    • Abnormal Termination of the process
    • Corrupted Header
  • User Error
    • File Deletion/Renaming
    • File Swapping
  • 3rd Party Software
    • Filter Drivers
    • Outdated/Faulty Device Driver

Recovery Flows
  • master Database
  • model Database
  • msdb Database
  • tempdb Database
  • User Database

Ads