x

If DBCC CHECKDB shows my database is corrupted, how do I know when it became corrupted?

I created a job that runs daily (every midnight) that uses DBCC CHECKDB on every database. Every day in the morning I launch SSMS to look at the logs and hope to see CHECKDB found 0 allocation errors lines.

But if I pass some days without checking the logs and discover that some database is corrupted, how can I know when the corruption ocurred to restore the backups from that point in time?

more ▼

asked Feb 25, 2010 at 09:44 PM in Default

4efe27c0 gravatar image

4efe27c0
85 2 2 3

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

Check in the table msdb.dbo.suspect_pages. It has useful information about which pages are suspect, although the date in there shows you when it was last seen to be suspect, which isn't exactly what you want.

Have a look at what type of page it is that's corrupt. If it's a page for a nonclustered index page, then just rebuild the index. If it's a table, then do a page level restore. You will know straight away if you restore that page from a backup where it's also corrupt, because the restore will fail.

Your best bet is really to look at your history of DBCC results.

more ▼

answered Feb 26, 2010 at 12:29 AM

Rob Farley gravatar image

Rob Farley
5.7k 16 18 20

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x75
x47
x19

asked: Feb 25, 2010 at 09:44 PM

Seen: 2236 times

Last Updated: Feb 26, 2010 at 05:34 AM