I want to clear out the procedure cache for just one database, not the entire SQL Server. Is there a way?
Asked
Active
Viewed 9,170 times
2 Answers
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.
Danilo Braga
- 1,428
- 2
- 14
- 22
4
Another way to clear cache is to use DBCC freesystemcache
DBCC FREESYSTEMCACHE ('userdatabase') -- cleans cache for specific user database