Determine SQL Server memory use by database and object
How to List Dirty Pages From Memory in SQL Server?
How to View the Dirty Pages In Memory of a Database?
FOR PAID SQL TRAINING AND SUPPORT Pleases contact - vikashk.dba@gmail.com
Script:
--list all the dirty pages from the memory
SELECT db_name(database_id) AS 'Database',
page_id AS 'Dirty Pages',
FILE_ID,
page_type,
page_level
FROM sys.dm_os_buffer_descriptors
WHERE is_modified =1
---SQL Server which database takes all memory
--Determine SQL Server memory use by database and object
DECLARE @buffer INT;
SELECT @buffer = cntr_value
FROM sys.dm_os_performance_counters
WHERE RTRIM([object_name]) LIKE '%Buffer Manager'
AND counter_name = 'Total Pages';
;WITH buffer_descriptors AS
(
SELECT
database_id, db_buffer_pages = COUNT(*)
FROM sys.dm_os_buffer_descriptors
GROUP BY database_id
)
SELECT
DB_NAME([database_id]) as DB_Name ,
db_buffer_pages,
db_buffer_pages / 128 as db_buffer_MB
FROM buffer_descriptors
ORDER BY db_buffer_MB DESC;
On this page of the site you can watch the video online Which SQL Server database taking all memory ? with a duration of hours minute second in good quality, which was uploaded by the user Vikash DBA (RDMS tutorial)-SQL GUIDE 31 August 2022, share the link with friends and acquaintances, this video has already been watched 408 times on youtube and it was liked by 12 viewers. Enjoy your viewing!