question

4efe27c0 avatar image
4efe27c0 asked

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?

error-messagedbcccorruption
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Rob Farley avatar image
Rob Farley answered

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.

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.