from what i know, if i execute 'DBCC FREEPROCCACHE' and 'DBCC DROPCLEANBUFFERS', the buffer of entire server will be cleanup. i wonder if there's anyway to cleanup buffer of specified database only. therefore, query for other databases will not be affected.
can i cleanup buffer for some specified database instead of the entire sql server
4.6k Views Asked by Narutokk At
2
There are 2 best solutions below
0

You can clear all execution plans from a single database using DBCC FLUSHPROCINDB(<db_id>)
. I'm not aware of any similar command to clear specific pages from the buffer cache.
However, you can set the database offline momentarily and then back online to clear both plan and buffer caches for a database if the situation allows for this.
Not a possibility with
FREEPROCCACHE
orDBCC FREEPROCCACHE
As per msdn https://msdn.microsoft.com/en-us/library/cc293622.aspx
db id can be fetched this way