Skip to content

DBCC FreeSessionCache

Being day 13 of the DBCC Command month at SteveStedman.com, today’s featured DBCC Command is DBCC FREESESSIONCACHE.

Description:

DBCC FreeSessionCache is only available on SQL Server 2005 and newer it removes all queries from the distributed query cache. This however does not impact anything in the standard procedure cache, to clear the standard procedure cache use DBCC FreeProcCache instead. The distributed query cache contains the queries that used the OPENROWSET and OPENDATASOURCE functions to connect to remote data sources.  There is not output generated other than the standard completed message.

DBCC FreeSessionCache Syntax:

DBCC FreeSessionCache

Example:

The following example clears all distributed queries from the distributed query cache.

DBCC FreeSessionCache

Which produces the following output.

DBCC_freeSessionCache1

Notes:

One of the less common DBCC commands, keep in mind if you really want to clear the procedure cache use DBCC FreeProcCache instead.

For more information see TSQL Wiki DBCC freesessioncache.

DBCC Command month at SteveStedman.com is almost as much fun as sitting in the waiting room at the dentist.

 

 


More from Stedman Solutions:

SteveStedman5
Steve and the team at Stedman Solutions are here for all your SQL Server needs.
Contact us today for your free 30 minute consultation..
We are ready to help!

Leave a Reply

Your email address will not be published. Required fields are marked *