NOTE: Updated scripts below as of March 1, 2015
I have created the following script to calculate MAX memory setting on a dedicated SQL server.
The script will show total memory, MAX memory in use, MIN memory in use, New calculated MAX and MIN memory setting.
There are 2 versions of this script because of how to detect the total memory of the SQL Server.
MAX Memory script for SQL Server 2005 to 2008R2
Enjoy!
Rudy
Great Script.. Thank You. Can you add direction on how to take your script results and have it use the MAX MEM (SQLMaxMemoryMegaByte) results to automatically change/update the SQL settings (i.e. sp_configure max server memory)?
ReplyDeleteHello Tec_Chief,
ReplyDeleteThank you for your comments. The code can be modified to do what you are requesting but I haven't done the automatically updating sp_configure but here is how to start.
USE master;
GO
-- All sp_configure to show all options
EXEC sp_configure 'show advanced option', '1';
GO
-- View setting of sp_configure
EXEC sp_configure
GO
-- Set max server memory
EXEC sp_configure 'max server memory (MB)', @SQLMaxMemoryMegaByte
GO
RECONFIGURE
GO
NOTE*** The code here does not work because sp_configure doesn't see to like variables (@SQLMaxMemoryMegaByte) so you will have to play around with this part in order to get it to work.
Hope this helps and thanks for reading my blog.
If you decide to modify my script and post is it somewhere, please mention my name. I'm trying to get more people to ready my blog.
Thanks,
Rudy