Before running a performance test / baseline for an app that uses SQL Server, I want to be able to set the instance to a "clean" state, without restarting the instance. There are steps I tend to follow, but I want to build a definitive list that is in the correct sequence, and has no redundant steps.
Does this list of steps accomplish setting SQL Server to a "clean" state?
Is the sequence logical / correct?
Are there any redundant steps?
CHECKPOINT -- Write all dirty pages DBCC DROPCLEANBUFFERS -- All should be clean after checkpoint? DBCC FREEPROCCACHE -- Clear the plan cache DBCC FREESYSTEMCACHE -- Is this necessary after FREEPROCCACHE? DBCC FREESESSIONCACHE -- May not be necessary if distributed queries aren't used, but want to catch all scenarios EXEC SP_UPDATESTATS -- Refresh stats 'BEGIN TESTING!'