Scheduled restart of SQL server

May 26, 2008

As you may notice, Microsoft SQL Server will gradually consume more and more memory after it starts…Most people (us included) will wonder if this means that there are memory leaks or unclosed connections.  While you should make sure to close all unused connection, this is actually normal behavior — just check the Microsoft knowledge base #321363

While there are a variety of memory configuration options, we have a nice bandaid fix: restart SQL server during off hours.  Simply make a .bat file with the code below and use windows scheduler to run the file when traffic is low:

@ECHO OFF
NET STOP SQLSERVERAGENT
NET STOP MSSQLSERVER
NET START MSSQLSERVER
NET START SQLSERVERAGENT