From the course: SQL Server 2016: Administer a Database Infrastructure

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Recover from database corruption

Recover from database corruption - SQL Server Tutorial

From the course: SQL Server 2016: Administer a Database Infrastructure

Start my 1-month free trial

Recover from database corruption

- [Instructor] So you've identified that your database suffers from a corruption problem through the check DB console command. Now what? Well first, you need to know where the corruption exists. Check DB will tell you what components of your database are corrupted. Make a copy of that output, print it out if necessary, and review it thoroughly. Determine the exact objects that are problematic. If corruption has occurred on a nonclustered index, you can likely just rebuild it. To do that, first we'll switch into the right database. Then we'll alter the index that was identified by check DB. We'll go ahead and set its state to disable. Then, we can alter the index again, this time rebuilding it with online equals on. That'll go through the process of recreating that index, and hopefully fix any corruption problems. If it's a data table or other component that's corrupted, then it's likely that you'll need to turn either to a restore or repair scenario. Restores are more reliable but…

Contents