Created
June 21, 2017 17:44
-
-
Save LitKnd/cb2e6793de675075c56aa210815e0f8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
ISNULL(CASE bd.database_id | |
WHEN 32767 THEN 'resource' | |
ELSE db.name END, 'TOTAL') as database_name, | |
count(*) * 8./1024./1024. as page_GB, | |
sum(free_space_in_bytes) /1024./1024./1024. as free_space_MB | |
FROM sys.dm_os_buffer_descriptors as bd | |
LEFT OUTER JOIN sys.databases as db on bd.database_id = db.database_id | |
GROUP BY | |
CASE bd.database_id WHEN 32767 THEN 'resource' ELSE db.name END | |
WITH ROLLUP | |
ORDER BY page_GB desc; | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment