SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How can I find the Total free memory in the windows machine where a sqlserver instances are...


How can I find the Total free memory in the windows machine where a sqlserver instances are installed?

Author
Message
Max88
Max88
SSC Rookie
SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)

Group: General Forum Members
Points: 31 Visits: 65
Hello,

I need to find the free memory in the machine where a SQL server 2008 r2 is installed, and I need to do it via T SQL.
Are the table:
sys.dm_os_sys_info or
sys.dm_os_sys_memory
about this or not? I've found out different opinion in the internet and I've been told that with this query I can only find the RAM available:

select available_physical_memory_kb
from master.sys.dm_os_sys_memory

is this true?
how can I find the total space available in all unit C:/ with a query?
thanks a lot.
Bajrang
Bajrang
SSC Eights!
SSC Eights! (882 reputation)SSC Eights! (882 reputation)SSC Eights! (882 reputation)SSC Eights! (882 reputation)SSC Eights! (882 reputation)SSC Eights! (882 reputation)SSC Eights! (882 reputation)SSC Eights! (882 reputation)

Group: General Forum Members
Points: 882 Visits: 248
Probably, this is what you were looking for!!!


select
Name as 'Database'
, Filename as 'Location'
, convert(numeric(10,2),round(a.size/128.000,2)) as SizeMB
, convert(numeric(10,2),round(fileproperty(a.name,'SpaceUsed')/128.000,2)) as UsedSpaceMB
, convert(numeric(10,2),round((a.size-fileproperty(a.name,'SpaceUsed'))/128.000,2)) as FreeSpaceMB
, convert(numeric(10,4),round(fileproperty(a.name,'SpaceUsed')/128.000,2)/1000) as UsedSpaceGB
, convert(numeric(10,4),round((a.size-fileproperty(a.name,'SpaceUsed'))/128.000,2)/1000) as FreeSpaceGB
from dbo.sysfiles a



-RP
Max88
Max88
SSC Rookie
SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)

Group: General Forum Members
Points: 31 Visits: 65
Using this function I have the attended result

xp_fixeddrives

with the query that you wrote I have different data, I will verify it.

thanks a lot
Erland Sommarskog
Erland Sommarskog
SSCertifiable
SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)SSCertifiable (5.2K reputation)

Group: General Forum Members
Points: 5240 Visits: 875
The thread is confusing. Are you looking for disk space or RAM?

xp_fixeddrives indeed gives you the available amount of free disk space (not the total space).

If you want to know the total amount of free RAM in the machine, I don't think there is a DMV that exposes this, nor is there any reason why there should be. There is little reason why SQL Server would track what else is going on in the machine. But if there is a command-line command to give you the information, you could invoke it through xp_cmdshell.

Erland Sommarskog, SQL Server MVP, www.sommarskog.se
Bajrang
Bajrang
SSC Eights!
SSC Eights! (882 reputation)SSC Eights! (882 reputation)SSC Eights! (882 reputation)SSC Eights! (882 reputation)SSC Eights! (882 reputation)SSC Eights! (882 reputation)SSC Eights! (882 reputation)SSC Eights! (882 reputation)

Group: General Forum Members
Points: 882 Visits: 248
True..
XP_Fixeddrives will give actual free disk space on the server.. whereas script I gave above will give detail about size of the file and amount of space that is used by specified file... Sorry for the confusion..

-RP
arnipetursson
arnipetursson
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1375 Visits: 1019
SELECT distinct volume_mount_point
,cast(available_bytes as decimal)/1073741824 as [Space_in_GB]
FROM sys.master_files AS f
CROSS APPLY sys.dm_os_volume_stats(f.database_id, f.file_id)

from http://connect.microsoft.com/SQLServer/feedback/details/642004/denali-xp-fixeddrives-does-not-display-mounted-volume-information-on-a-cluster
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search