16

I'm managing about 90 SQL Server instances and need a query to determine how much memory has been allocated to each instance. Please note, I'm not asking how to set it, just to see what it's currently set to without using the Management Studio.

Thanks for your help.

token
  • 275
  • 1
  • 3
  • 9
  • When executed this on my system. values is given as 2147483647 , my system RAM is only 2 GB, in this case how I consider return value as MB. if I conside it as MB then my system RAM should be 2097152 GB –  Apr 17 '13 at 05:27
  • It is the configured value, not your actual RAM. It allows SQL Server to take up to this amount of memory (including virtual memory) – MichelZ May 04 '18 at 12:39

1 Answers1

29

Try this on the master database:

SELECT name, value, value_in_use, [description] 
FROM sys.configurations
WHERE name like '%server memory%'
ORDER BY name OPTION (RECOMPILE);

Gives you max server memory (MB) and min server memory (MB)

MichelZ
  • 11,008
  • 4
  • 30
  • 58
  • 1
    Just a note if you are using sqlcmd.exe: I'd recommend using the `-W` switch to trim whitespaces as described [here](http://social.msdn.microsoft.com/Forums/sqlserver/en-US/1b7b4234-e55c-41b0-9e25-3a61dea3ee2f/sqlcmd-strip-white-space) - there are quite a lot of them (at least on my setup). – ChriPf May 22 '14 at 13:07