List of All Undocumented DBCC Commands in SQL Server

SQLServerF1

As a SQL Server DBA, it is very command to use various DBCC commands to retrieve data required to understand problems or to get the certain status information or details. DBCC stands for Database Console Commands. There are many documented and undocumented DBCC commands in SQL Server which are very useful for DBAs and are used in different usage like to retrieve usage information, to run maintenance tasks, To validate databases, and other Miscellaneous purposes.

Below are some of the undocumented DBCC commands. Undocumented DBCC commands are used by Microsoft support to get more insights about internal behavior.

Note: Please note that it is not recommended to use the undocumented DBCC commands and Microsoft does no provide any support for the behaviour caused by using undocumented DBCC commands.

DBCC AddExtendedProc(procname, DLL) – This command adds an extended procedure to the list maintained. It has same functionality of sp_addextendedproc stored procedure.

DBCC ADDINSTANCE(Object,Instance) – This command is used to add an object’s instance to the performance monitor.

DBCC BYTES(StartingAddress, Length) – This command returns the content of the memory area beginning at StartinAddress for length BYTES.

DBCC CALLFULLTEXT(FuncID[,CatID][,ObjID]) – This command is used to perform a variety if Full-Text related functions.

DBCC DBRecover(DBName) – This command can be used to manually recover the database. Normally databases are recovered at system startup, but for some reason if they fail, we can use this to recover the database manually.

DBCCC DBTable(DBID) – This command lists internal structures DB Table and FCB (File Control Block).

DBCC DELETEINSTANCE(Object,Instance) – This command is used to delete an object’s instance from the performance monitor which was previously set using ADDINSTANCE.

DBCC DES(DBID,ObjID) – This command lists system level descriptive information of the specified object.

DBCC DetachDB(DBName) – This command can be used to detach a database from the SQL Server instance.

DBCC DROPCLEANBUFFERS – This command can be used to clear or remove all the data from the memory.

DBCC DropExtendedProc(procname, DLL) – This command drops an extended procedure from the list maintained. It has same functionality of sp_dropextendedproc stored procedure.

DBCC ERRORLOG – This command closes the current errorlog and creates a new errorlog. This command is similar to sp_cycle_errorlog.

DBCC ExtentInfo(DBName, TableName, IndexID) – This command is used for listing the extent information for specified object.

DBCC FLUSHPROCINDB(DBID) – This command is used to force all the storedProcedures to be recomplied in specified database.

DBCC IND(DBID, ObjID[,PrintOpt{0|1|2}]) – This command can be used to list the system level index information for the specified object.

DBCC LockObjectsSchema(ObjectName) – This can be used to block other connections from modifying the schema of the specified object.

DBCC LOG(DBID) – This command is used to display the log record information from the specified database transaction log.

DBCC PRTIPAGE(DBID, ObjID, IndexID[,PrintOpt{0|1|2}]) – This command can be used to list the PAGE information for the specified index.

DBCC Resource – This can be used to list the resource usage information of the server.

DBCC TAB(DBID, ObjID[,PrintOpt{0|1|2}]) – This command lists system related information of specified table.

DBCC UpgradeDB(DBName) – This command is used to upgrade the system objects of specified database to the version of database engine.

Hope this was helpful.

Thanks,
SQLServerF1 Team
In-Depth Blogs on SQL Server, Information about SQL Server Conferences and Events, SQL Server Frequently asked questions, SQL Server Trainings.

 

List of SQL Server Miscellaneous DBCC Commands and Description

SQLServerF1

As a SQL Server DBA, it is very command to use various DBCC commands to retrieve data required to understand problems or to get the certain status information or details. DBCC stands for Database Console Commands. There are many documented and undocumented DBCC commands in SQL Server which are very useful for DBAs and are used in different usage like to retrieve usage information, to run maintenance tasks, To validate databases, and other Miscellaneous purposes.

Below are some of the DBCC commands related to Miscellaneous tasks such as enabling trace flags or removing a DLL from memory.

DBCC dllname (FREE) – Unloads the specified extended stored procedure DLL from memory. When an extended stored procedure is executed, the DLL remains loaded by the instance of SQL Server until the server is shut down. This statement allows for a DLL to be unloaded from memory without shutting down SQL Server. To display the DLL files currently loaded by SQL Server, execute sp_helpextendedproc.

DBCC FREESESSIONCACHE – Flushes the distributed query connection cache used by distributed queries against an instance of Microsoft SQL Server.

DBCC FREESYSTEMCACHE – Releases all unused cache entries from all caches. The SQL Server Database Engine proactively cleans up unused cache entries in the background to make memory available for current entries. However, you can use this command to manually remove unused entries from all caches or from a specified Resource Governor pool cache. Executing DBCC FREESYSTEMCACHE clears the plan cache for the instance of SQL Server. Clearing the plan cache causes a recompilation of all subsequent execution plans and can cause a sudden, temporary decrease in query performance. For each cleared cachstore in the plan cache, the SQL Server error log will contain the informational message.

DBCC HELP – Returns syntax information for the specified DBCC command. DBCC HELP returns a result set displaying the syntax for the specified DBCC command.

DBCC TRACEOFF – Disables the specified trace flags. Trace flags are used to customize certain characteristics controlling how the instance of SQL Server operates.

DBCC TRACEON – Enables the specified trace flags. Trace flags are used to customize certain characteristics by controlling how SQL Server operates. Trace flags, after they are enabled, remain enabled in the server until disabled by executing a DBCC TRACEOFF statement. In SQL Server, there are two types of trace flags: session and global. Session trace flags are active for a connection and are visible only for that connection. Global trace flags are set at the server level and are visible to every connection on the server. To determine the status of trace flags, use DBCC TRACESTATUS. To disable trace flags, use DBCC TRACEOFF.

This is applicable on below versions of SQL Server

SQL Server 2005
SQL Server 2008 R2
SQL Server 2012
SQL Server 2014

Hope this was helpful.

Thanks,
SQLServerF1 Team
In-Depth Blogs on SQL Server, Information about SQL Server Conferences and Events, SQL Server Frequently asked questions, SQL Server Trainings.