sp_Blitz Result: DBCC CHECKDB Not Run Recently
When SQL Server writes data to your drives, it just assumes everything’s okay until it needs to read the data back again. Unfortunately, in the event of storage corruption, the storage isn’t so kind as to alert SQL Server. We need to periodically check to make sure the data on disk still makes sense, and that’s where DBCC CHECKDB comes in. It checks for both allocation errors and consistency errors. Additionally, if there are any issues, the error messages will come back with information regarding where the errors exist, the severity of the error as well as the suggested repair option.
It’s essential to run CHECKDB on a regular basis to find errors if they exist because if there’s corruption, we need to fix it before our last good backups disappear.
This part of our SQL Server sp_Blitz script checks each database to make sure DBCC CHECKDB has completed a successful check in the last two weeks.
To Fix the Problem
If you’re using maintenance plans, you can edit maintenance plans in SQL Server Management Studio under Management, Maintenance Plans. Your server may have multiple maintenance plans, like one for system databases and one for user databases.
If you’re implementing integrity checks for the first time, consider using Ola Hallengren’s free maintenance scripts. They’re not quite as easy as maintenance plans, but they’re much more flexible. They also include the ability to break up DBCC operations into smaller chunks for large databases. On very large databases CHECKDB can take a significant amount of time and resources – the WITH PHYSICAL_ONLY option is faster, but omits the logical checks.