• Toreador (8/20/2010)


    Hugo Kornelis (8/20/2010)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.

    Which version is that on? With 2008 I get

    The check statement was aborted. DBCC CHECKALLOC cannot be run on TEMPDB.

    The check statement was aborted. DBCC CHECKCATALOG cannot be run on TEMPDB.

    I get the same message (SQL 2005). But those are informational messages, not error messages.

    BEGIN TRY;

    DBCC CHECKALLOC (tempdb);

    DBCC CHECKCATALOG (tempdb);

    PRINT 'No errors';

    END TRY

    BEGIN CATCH;

    PRINT 'Error';

    END CATCH;

    The check statement was aborted. DBCC CHECKALLOC cannot be run on TEMPDB.

    DBCC execution completed. If DBCC printed error messages, contact your system administrator.

    The check statement was aborted. DBCC CHECKCATALOG cannot be run on TEMPDB.

    DBCC execution completed. If DBCC printed error messages, contact your system administrator.

    No errors

    So you can not get SQL Server to check allocation or catalog in tempdb, but you can run these commands. Hairsplitting, I know - but when I answered the question, I found mysself wondering what interpretation the author would use.


    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/