1

According to SQL Server Maintenance Solution - SQL Server Integrity Check, the SYSTEM_DATABASES value includes only master, msdb, and model.

Why is TempDB excluded, when it too can have hardware issues causing page corruptions?

Interestingly enough, DBCC CheckDB FAQ: Check for Corruption in SQL Server by Kendra Little talks about the need to check TempDB but points to the Ola Hallengren script, which does not appear to be checking TempDB by default.

0

2 Answers 2

4

Answer based on a comment left by Randi Vertongen:

Ola mentioned a long time ago (+5 years) on SQL Server Central that this is by default:

This is by design. DatabaseIntegrityCheck is not doing checkdb on tempdb.

and a way around it by adding it explicitly.

In the latest version you can do like this:

EXECUTE dbo.DatabaseIntegrityCheck
      @Databases = 'SYSTEM_DATABASES,tempdb',
      @CheckCommands = 'CHECKDB'

He goes on to say:

When I developed the scripts I was looking at how Microsoft was doing in the Maintenance Plans. They are not doing checkdb for tempdb, so I did also not do that. Some time ago I added support for checking of tempdb, but not as the default. You need to specify tempdb explicitly.

Not entirely sure if this is still the case.

2

Ola's scripts do not do checkdb on tempdb as seen in the code base. Tempdb is a scratch db and gets recreated when sql server reboots.

Brent has a point in doing checkdb on tempdb. You can file an issue on github to get it into future release.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.