SELECT [Database Name] AS 'DB명', sum([Page Count]) AS '사용량'

FROM (

SELECT

   (CASE WHEN ([is_modified] = 1) THEN 'Dirty' ELSE 'Clean' END) AS 'Page State',

   (CASE WHEN ([database_id] = 32767) THEN 'Resource Database' ELSE DB_NAME (database_id) END) AS 'Database Name',

   COUNT (*) AS 'Page Count'

FROM sys.dm_os_buffer_descriptors

WHERE database_id between 5 and 1000

GROUP BY [database_id], [is_modified]

) as K

GROUP BY [Database Name]

ORDER BY sum([Page Count]) DESC, [Database Name]

 

 

 

원본링크 : http://symplog.tistory.com/382

+ Recent posts