Saturday, 29 November 2014



Whenever we get performance issues, we look how much memory is left available for that we have to login Windows box and have to look on task manager.Using SQL Server DMV also we can find. Pls run below query to find out the memory details.

SELECT total_physical_memory_kb/1024 as TotalMemoryMB, available_physical_memory_kb/1024 AvailableMemoryMB,
(total_physical_memory_kb - available_physical_memory_kb)/ 1024  as UsedMemoryMB
FROM sys.dm_os_sys_memory

If you want to find out, how much memory is using each database in SQL Server 2008 running below query you can find out.


SELECT  CASE database_id
        WHEN 32767 THEN 'ResourceDb'
        ELSE db_name(database_id)
        END AS DatabaseName, cast((count(*) * 8.0)/1024.0 as decimal(10,1)) as UsedMemoryMB 
FROM sys.dm_os_buffer_descriptors
GROUP BY database_id
ORDER BY database_id DESC

No comments:

Post a Comment