Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 454
  • Last Modified:

REPAIRING A corrupt sql database

Hi Folks,

I was just looking at the documentation for dbcc checkdb and I took notice of the REPAIR OPTIONS. It recommends that to repair errors you should restore from backup. To my way of thinking that would defeat the purpose of running the command anyway. If the db was corrupt wouldn't restoring from a good backup fix all your problems anyway? Is there any good doco on this?

Kind Regards

0
david_32
Asked:
david_32
  • 2
  • 2
1 Solution
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
0
 
david_32Author Commented:
Sorry .... question was a bit vague.

Microsoft recommends restoring from backup rather than dbcc checkdb
http://msdn.microsoft.com/en-us/library/ms176064.aspx

why is that?
0
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
Yes.. Even I suggest you to go for Backup if your Backup file is not corrupt. As your Backup file is corrupt, I have suggested that option because using dbcc checkdb, you can fix those errors (either by losing some records or by skipping the error records).

Restoring through DBCC has the following demerits (explained in more detail in the link which you provided)

DBCC CHECKDB does not examine disabled indexes
executing DBCC CHECKDB clears the plan cache for the instance of SQL Server.
0
 
david_32Author Commented:
thanks - I didn't know that it clears the plan cache as well - that helped me with another issue I am having - you should get double points :)
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now