Scheduled restart 🔄 of SQL server

Scheduled restart 🔄 of SQL server

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

While there are a variety of memory configuration options, I 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
Written by
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.