• I got it right, but it was a coinflip. You can actually run DBCC CHECKALLOC and DBCC CHECKCATALOG on tempdb. You will not get an error, but on the other hand, nothing will actually be done.

    Even Books Online seems unsure about this subject. The reference given in the explanation does indeed state that these commands can't be run on tempdb. But the topics on DBCC CHECKALLOC and DBCC CHECKCATALOG themselves say it can be run - this is the exact quote from DBCC CHECKALLOC (http://msdn.microsoft.com/en-us/library/ms188422.aspx):

    "Note

    In SQL Server 2005 and later, running DBCC CHECKALLOC against tempdb does not perform any checks. This is because, for performance reasons, database snapshots are not available on tempdb. This means that the required transactional consistency cannot be obtained. Stop and start the MSSQLSERVER service to resolve any tempdb allocation issues. This action drops and re-creates the tempdb database."

    The DBCC CHECKCATALOG topic (http://msdn.microsoft.com/en-us/library/ms186720.aspx) has a similar note.

    To me, this says that you can run the command. But nothing will happen.

    When deciding whether the author of this question intended to ask if we can execute the command on tempdb and not get an error (yes, we can), or if we can get SQL Server to actually perform the checks that these DBCC commands do on tempdb (no, we can't), I went with the latter.

    (Steps aside and makes room for the angry comments by those who picked the other option and now "want their point back")


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/