|
|
|
SSChasing Mays
      
Group: General Forum Members
Last Login: Saturday, April 06, 2013 12:20 AM
Points: 649,
Visits: 263
|
|
| Comments posted to this topic are about the item TempDB
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Monday, June 10, 2013 12:41 AM
Points: 350,
Visits: 427
|
|
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
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 3:50 PM
Points: 5,289,
Visits: 7,219
|
|
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 MVP Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 10:23 AM
Points: 1,381,
Visits: 4,859
|
|
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.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 3:50 PM
Points: 5,289,
Visits: 7,219
|
|
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 MVP Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Monday, April 29, 2013 10:56 AM
Points: 751,
Visits: 129
|
|
SQL 2000, DBCC CHECKALLOC & DBCC CHECKCATALOG runs ok
Mis-read the 'Perform' in the question and missed the right choice.
Glen Parker
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Yesterday @ 8:24 AM
Points: 1,526,
Visits: 1,561
|
|
| 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.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Wednesday, June 05, 2013 11:39 AM
Points: 2,679,
Visits: 2,422
|
|
| 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.
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Friday, March 15, 2013 2:43 PM
Points: 3,924,
Visits: 1,554
|
|
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.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 10:42 AM
Points: 6,375,
Visits: 5,425
|
|
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.
|
|
|
|