Checkpoint--查看各DB上的脏页

 

可以使用sys.dm_os_buffer_descriptors来看数据页在buffer pool中的状态,其中is_modified来标示数据页是否为脏页

-----------------------------------------------------------------------------------------------------------------------

--查看各DB上的脏页

SELECT DB_NAME(database_id) AS DBName
,COUNT(1) AS DirtyPageCount 
FROM sys.dm_os_buffer_descriptors
WHERE is_modified=1
GROUP BY database_id

 

查看某个DB上脏页的分布情况

SELECT  OBJECT_NAME(p.[object_id]) AS [TableName] 
, ISNULL(i.name, ‘-- HEAP --‘) AS ObjectName 
, COUNT(1) AS PagesCount
FROM sys.allocation_units AS a 
INNER JOIN sys.dm_os_buffer_descriptors AS b 
ON a.allocation_unit_id = b.allocation_unit_id 
INNER JOIN sys.partitions AS p 
INNER JOIN sys.indexes i 
ON p.index_id = i.index_id 
AND p.[object_id] = i.[object_id] 
ON a.container_id = p.hobt_id 
WHERE b.database_id = DB_ID() 
AND B.is_modified=1
GROUP BY p.[object_id], i.name

Checkpoint--查看各DB上的脏页

上一篇:DBCC--SQLPERF


下一篇:微信公共服务平台开发(.Net 的实现)8-------处理图片(上传下载发送)