Consommation de la mémoire

Transcription

Consommation de la mémoire
fjconseil
Consommation de la mémoire
13-08-2010
Dernière mise à jour : 10-10-2012
Permet de voir dynamiquement ou la mémoire est consommée :
select (single_pages_kb+multi_pages_kb) as pages_kb,type, name, single_pages_kb, multi_pages_kb from
sys.dm_os_memory_clerks where single_pages_kb > 0 or multi_pages_kb >0
order by pages_kb desc
- Utilisation mémoire par bases de données
USE master
GO
SELECT
DB_NAME (database_id) AS 'Database Name',
SUM(CASE WHEN ([is_modified] = 1) THEN 0 ELSE 1 END) * 8 / 1024 AS 'CleanPageCount (Mb)',
SUM(CASE WHEN ([is_modified] = 1) THEN 1 ELSE 0 END) * 8 / 1024 AS 'DirtyPageCount (Mb)'
FROM sys.dm_os_buffer_descriptors WITH(NOLOCK)
WHERE DB_NAME (database_id) IS NOT NULL
GROUP BY database_id
ORDER BY 2 DESC
GO
- Utilisation mémoire par objets de bases de données
-- Se mettre dans le contexte de la base à scanner
SELECT name, count(*) * 8 / 1024 AS 'cached_pages_count (Mb)'
FROM sys.dm_os_buffer_descriptors AS bd
INNER JOIN
(
SELECT object_name(object_id) AS name
,index_id ,allocation_unit_id
FROM sys.allocation_units AS au
INNER JOIN sys.partitions AS p
ON au.container_id = p.hobt_id
AND (au.type = 1 OR au.type = 3)
UNION ALL
SELECT object_name(object_id) AS name
,index_id, allocation_unit_id
FROM sys.allocation_units AS au
INNER JOIN sys.partitions AS p
ON au.container_id = p.partition_id
AND au.type = 2
) AS obj
ON bd.allocation_unit_id = obj.allocation_unit_id
WHERE database_id = db_id()
GROUP BY name
ORDER BY 2 DESC;
GO
- Utilisation mémoire par clerck type
SELECT
[type] AS [Memory Clerk Type] ,
SUM(pages_kb) AS [SPA Mem, Kb]
FROM sys.dm_os_memory_clerks
GROUP BY [type]
ORDER BY SUM(pages_kb) DESC
OPTION ( RECOMPILE ) ;
Permet de visualiser chaque element de la mémoire :
DBCC MEMORYSTATUS
The target number of buffers represents the number of 8KB pages SQL Server can commit without causing paging. The
value of target buffers cannot exceed "max server memory" option. If this number diminishes, SQL Server might be
http://www.fjconseil.fr/joomla
Propulsé par Joomla!
Généré: 30 September, 2016, 03:51
fjconseil
experiencing external memory pressure. If the target number of buffers is lower than the min server memory
configuration setting, that indicates that SQL Server was never able to acquire the minimum amount of allocated memory
because this memory isn't available through the operating system you'd need to check to see if other applications are
consuming the memory on the same server. Recall that "min server memory" and "max server memory" control the size
of the buffer pool.
You should also examine the value of "stolen pages". If this value represents the large majority of target buffers then we
might be experiencing internal memory issues. You can query sys.dm_os_memory_clerks view to figure out exactly
which components are using the majority of memory. Note that you cannot alter the internal memory distribution, but you
can tweak the amount of memory dedicated to each area of SQL Server memory.
Permet de visualiser chaque element de la mémoire :
SELECT usecounts, cacheobjtype, objtype, TEXT
FROM sys.dm_exec_cached_plans
CROSS APPLY sys.dm_exec_sql_text(plan_handle)
WHERE usecounts > 0
ORDER BY usecounts DESC;
GO
Lien expliquant simplement le contenu de la memoire SQL Server :
http://www.teratrax.com/sql-server-memory-cache/
http://www.fjconseil.fr/joomla
Propulsé par Joomla!
Généré: 30 September, 2016, 03:51

Documents pareils