Reputation: 787
i want to automatically restart sql server after nightly rebuild index (in a job) to free memory.
any solution?
Upvotes: 0
Views: 2004
Reputation: 467
It looks like you may be seeing poor performance from SQL Server as the server has stolen all the RAM from the Operating Systyem. Check that the total memory available to all instances of SQL server on your server leaves enough for the OS to work in RAM (4Gb or so).
Upvotes: 0
Reputation: 425361
A direct answer to your question would be to write a batch job:
net stop MSSQLSERVER
net start MSSQLSERVER
and schedule it in Windows Scheduler.
However, I wonder:
DBCC DROPCLEANBUFFERS
will purge the buffer pool which is the only thing that will be seriously affected, but why would you want to clean it?Upvotes: 2
Reputation: 46913
You do not want to restart SQL Server to free memory. It is using memory to improve performance. Restarting it merely forces it to recache everything AGAIN at the cost of query performance.
Upvotes: 3