August 20, 2010 at 12:54 am
Basic question, but still good one.
- SAMJI
If you marry one they will fight with you, If you marry 2 they will fight for you 🙂
August 20, 2010 at 12:56 am
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")
August 20, 2010 at 2:28 am
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.
August 20, 2010 at 2:55 am
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.
August 20, 2010 at 3:22 am
SQL 2000, DBCC CHECKALLOC & DBCC CHECKCATALOG runs ok
Mis-read the 'Perform' in the question and missed the right choice.
Glen Parker 🙂
August 20, 2010 at 6:38 am
I guess if we really want to split hairs and get technical, it is possible to drop tempdb. Stopping and starting the SQLService or rebooting the server will result in tempdb being dropped and recreated.
August 20, 2010 at 7:13 am
Great question....I am not a DBA and this is sort of a DBA question. That is why I love QoTD. It makes me explore areas that are not in my primary skill set or a part of my daily concern.
August 20, 2010 at 8:06 am
Was sure about other three answers but not sure about
Running DBCC CHECKALLOC or DBCC CHECKCATALOG
I executed them on all SQL Server versions and it could be executed successfully on SQL Server 6.5, SQL Server 7 and SQL Server 2000.
But 2005 and 2008 throws error.
The check statement was aborted. DBCC CHECKCATALOG cannot be run on TEMPDB.
The check statement was aborted. DBCC CHECKALLOC cannot be run on TEMPDB.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
SQL DBA.
August 20, 2010 at 9:56 am
Hugo Kornelis (8/20/2010)
(Steps aside and makes room for the angry comments by those who picked the other option and now "want their point back")
Nope. No angry comment 🙂
It is how you interpret 'performed'. On SQL2K it performs and produces output, which may indicate it did nothing but it still performed in a way.
Oh well, C'est la vie. 😀
Far away is close at hand in the images of elsewhere.
Anon.
August 20, 2010 at 10:02 am
Good question, thank you. I got it wrong because sadly I did not read the question carefully enough, and performed was the key. Running it does not produce any error, i.e.
use tempdb;
go
dbcc checkalloc with no_infomsgs;
go
reports "Command(s) completed successfully."
The question asked performed not ran, and BOL's verdict is clear:
In SQL Server 2005 and later, running DBCC CHECKALLOC against tempdb does not perform any checks.
Oleg
August 20, 2010 at 12:17 pm
Thanks for the question.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 17, 2010 at 1:05 pm
It has more that can't perform like:
Adding filegroups and Backing up or restoring the database
March 7, 2012 at 1:37 pm
Interesting question on the TempDB. Back to basics and the url below under the 'Restrictions' states all the facts too.
URL: http://msdn.microsoft.com/en-us/library/ms190768.aspx
Thanks
Viewing 14 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply