8

I want to clear out the procedure cache for just one database, not the entire SQL Server. Is there a way?

2 Answers 2

15
DBCC FLUSHPROCINDB (<db_id>)

This command allows you to specify a particular database id, and then clears all plans from that particular database. Check more information here.

DBCC FREEPROCCACHE

This command removes all cached plans from memory

It is, of course, recommended that you don’t use these commands on your production servers, as it could impact the performance of your running applications. Usually, you want to keep plans in cache.

1
  • 1
    Thanks for your answer. I used SELECT DB_ID('<db_name>') to get the database id.
    – Scott
    Aug 14, 2019 at 16:23
4

Another way to clear cache is to use DBCC freesystemcache

DBCC FREESYSTEMCACHE ('userdatabase') -- cleans cache for specific user database
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.