查看每个数据库对内存的占用
SELECT ISNULL(DB_NAME(DATABASE_ID),\'RESOURCEDB\') AS DATABASENAME, CAST(COUNT(ROW_COUNT) * 8.0 /(1024.0) AS DECIMAL(28,2)) AS \'SIZE(MB)\' FROM SYS.dm_os_buffer_descriptors GROUP BY database_id ORDER BY DATABASENAME
整个sql服务占用的总内存
SELECT SUM(single_pages_kb)+SUM(MULTI_PAGES_KB) FROM ( SELECT SUM(single_pages_kb) AS single_pages_kb ,SUM(MULTI_PAGES_KB) AS MULTI_PAGES_KB FROM SYS.dm_os_memory_clerks GROUP BY [TYPE] ) AS A UNION SELECT COUNT(ROW_COUNT) * 8.0 FROM SYS.dm_os_buffer_descriptors
-------引用------
浅谈SQL Server 对于内存的管理 - CareySon - 博客园 (cnblogs.com)
SqlServer内存占用查看 - 代码工人有力量 - 博客园 (cnblogs.com)
标签:COUNT,MULTI,管理,SUM,SQLSERVER,single,内存,SELECT From: https://www.cnblogs.com/leavind/p/17170882.html