SQL SERVER – DBCC Commands to Free SQL Server Memory Caches

Lots of people do not know that following command can be very helpful to clear your memory caches of SQL Server. I have often seen people restarting their entire system to clear the memory caches.

SQL SERVER - DBCC Commands to Free SQL Server Memory Caches clearcache-800x214

Though, often I do not see any reasons for dropping the memory caches, but there are always special scenarios when users have to drop all the cache from their system to give a fresh start to their system. Let us see commands to clear memory caches

DBCC commands to free several SQL Server memory caches:

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.

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

DBCC FREEPROCCACHE
Removes all elements from the procedure cache.

Note: Please be careful before you execute these commands on your server, as it will remove all the cache from your system. If you are business need is to remove the memory cache, go ahead and do it, but for any other reason, these commands are not advisable to run anywhere.

Reference: Pinal Dave (https://blog.sqlauthority.com), BOL

SQL Memory, SQL Scripts, SQL Server, SQL Server DBCC, SQL Stored Procedure
Previous Post
SQL SERVER – Enable Login – Disable Login using ALTER LOGIN – Change name of the ‘SA’
Next Post
SQL SERVER – Download SQL Server Management Studio Keyboard Shortcuts (SSMS Shortcuts)

Related Posts

Leave a Reply