Friday, October 21, 2005

Some Undocumented DBCC Commands

DBCC MEMORYSTATUS
This DBCC command provides detailed info about SQL Server memory usage

DBCC TRACEON(3604)
DBCC Resource
DBCC TRACEOFF(3604)
This DBCC command list SQL Server resource utilization

DBCC DBREINDEXALL('pubs')
This DBCC command will rebuild all the indexes for a user Database, the DB has to exclusively locked or you will get the error message “The database could not be exclusively locked to perform the operation.”

DBCC FLUSHPROCINDB
This will force a recompile of all the stored procedures in a database

DECLARE @ID INT
SET @id =DB_ID('pubs')
DBCC FLUSHPROCINDB(@ID)

No comments: