We are currently moving towards a 24/7/365 operating model – as such I am investigating our maintenance strategy.
One item I'm having trouble in figuring out is DBCC CHECKDB. I have seen numerous resources report that DBCC can be offloaded by performing a FULL backup, restoring that backup on a separate SQL instance, and running our CHECKDB on that restored copy. I've also found some resources that report this is not safe due to edge-case scenarios.
Is running CHECKDB safe if not run on the production database itself? If not, what parts are safe to run on a restored copy?
Best Answer
SQL Server expert Paul Randal discusses this option in his post CHECKDB From Every Angle: Consistency Checking Options for a VLDB
Other than the drawbacks that Paul mentions, I'm not aware of any problems with offloading the consistency checks to another system.
I provided an answer to a question - How to conduct integrity test on SQL Server database backup file? where I described the process we use at my shop.
One additional note: Corruption can happen anytime. Immediately after a good
DBCC CHECKDB
or successful backup, so make attempts to runDBCC
consistency checks often.