Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can i cleanup buffer for some specified database instead of the entire sql server

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.

like image 799
Kevin Yang Avatar asked Apr 06 '11 10:04

Kevin Yang


1 Answers

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.

like image 121
Martin Smith Avatar answered Sep 29 '22 20:09

Martin Smith