﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / Memory management in sqlserver. / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 00:46:29 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Memory management in sqlserver.</title><link>http://www.sqlservercentral.com/Forums/Topic1402039-391-1.aspx</link><description>Thank you very much Guys.This really helped me.Mithra.</description><pubDate>Thu, 03 Jan 2013 09:58:52 GMT</pubDate><dc:creator>Mithra</dc:creator></item><item><title>RE: Memory management in sqlserver.</title><link>http://www.sqlservercentral.com/Forums/Topic1402039-391-1.aspx</link><description>see this[code="sql"]--Bpool statsselect (bpool_committed * 8192)/ (1024*1024) as bpool_committed_mb, (cast(bpool_commit_target as bigint) * 8192) / (1024*1024) as bpool_target_mb,(bpool_visible * 8192) / (1024*1024) as bpool_visible_mbfrom sys.dm_os_sys_infogo  -- Get me physical RAM installed-- and size of user VASselect physical_memory_in_bytes/(1024*1024) as phys_mem_mb, virtual_memory_in_bytes/(1024*1024) as user_virtual_address_space_sizefrom sys.dm_os_sys_infogo---- Get me other information about system memory--select total_physical_memory_kb/(1024) as phys_mem_mb,available_physical_memory_kb/(1024) as avail_phys_mem_mb,system_cache_kb/(1024) as sys_cache_mb,(kernel_paged_pool_kb+kernel_nonpaged_pool_kb)/(1024) as kernel_pool_mb,total_page_file_kb/(1024) as total_virtual_memory_mb,available_page_file_kb/(1024) as available_virtual_memory_mb,system_memory_state_descfrom sys.dm_os_sys_memorygo-- Get me memory information about SQLSERVR.EXE process-- GetMemoryProcessInfo() API used for this-- physical_memory_in_use_kbselect physical_memory_in_use_kb/(1024) as sql_physmem_inuse_mb,locked_page_allocations_kb/(1024) as awe_memory_mb,total_virtual_address_space_kb/(1024) as max_vas_mb,virtual_address_space_committed_kb/(1024) as sql_committed_mb,memory_utilization_percentage as working_set_percentage,virtual_address_space_available_kb/(1024) as vas_available_mb,process_physical_memory_low as is_there_external_pressure,process_virtual_memory_low as is_there_vas_pressurefrom sys.dm_os_process_memorygoselect * from sys.dm_os_ring_buffers where ring_buffer_type like 'RING_BUFFER_RESOURCE%'goselect memory_node_id as node, virtual_address_space_reserved_kb/(1024) as VAS_reserved_mb,virtual_address_space_committed_kb/(1024) as virtual_committed_mb,locked_page_allocations_kb/(1024) as locked_pages_mb,single_pages_kb/(1024) as single_pages_mb,multi_pages_kb/(1024) as multi_pages_mb,shared_memory_committed_kb/(1024) as shared_memory_mbfrom sys.dm_os_memory_nodeswhere memory_node_id != 64go  with vasummary(Size,reserved,free) as ( select size = vadump.size,reserved = SUM(case(convert(int, vadump.base) ^ 0)  when 0 then 0 else 1 end),free = SUM(case(convert(int, vadump.base) ^ 0x0) when 0 then 1 else 0 end)from(select CONVERT(varbinary, sum(region_size_in_bytes)) as size,region_allocation_base_address as basefrom sys.dm_os_virtual_address_dumpwhere region_allocation_base_address &amp;lt;&amp;gt; 0x0group by region_allocation_base_addressUNION(select CONVERT(varbinary, region_size_in_bytes),region_allocation_base_addressfrom sys.dm_os_virtual_address_dumpwhere region_allocation_base_address = 0x0))as vadumpgroup by size)  select * from vasummarygo -- Get me all clerks that take some memory--select * from sys.dm_os_memory_clerkswhere (single_pages_kb &amp;gt; 0) or (multi_pages_kb &amp;gt; 0)or (virtual_memory_committed_kb &amp;gt; 0)go-- Get me stolen pages--select (SUM(single_pages_kb)*1024)/8192 as total_stolen_pagesfrom sys.dm_os_memory_clerksgo-- Breakdown clerks with stolen pagesselect type, name, sum((single_pages_kb*1024)/8192) as stolen_pagesfrom sys.dm_os_memory_clerkswhere single_pages_kb &amp;gt; 0group by type, nameorder by stolen_pages descgo-- Get me the total amount of memory consumed by multi_page consumers--select SUM(multi_pages_kb)/1024 as total_multi_pages_mbfrom sys.dm_os_memory_clerksgo-- What about multi_page consumers--select type, name, sum(multi_pages_kb)/1024 as multi_pages_mbfrom sys.dm_os_memory_clerkswhere multi_pages_kb &amp;gt; 0group by type, nameorder by multi_pages_mb descgo-- Let's now get the total consumption of virtual allocator--select SUM(virtual_memory_committed_kb)/1024 as total_virtual_mem_mbfrom sys.dm_os_memory_clerksgo-- Breakdown the clerks who use virtual allocator--select type, name, sum(virtual_memory_committed_kb)/1024 as virtual_mem_mbfrom sys.dm_os_memory_clerkswhere virtual_memory_committed_kb &amp;gt; 0group by type, nameorder by virtual_mem_mb descgo-- Is anyone using AWE allocator?--select SUM(awe_allocated_kb)/1024 as total_awe_allocated_mbfrom sys.dm_os_memory_clerksgo-- Who is the AWE user?--select type, name, sum(awe_allocated_kb)/1024 as awe_allocated_mbfrom sys.dm_os_memory_clerkswhere awe_allocated_kb &amp;gt; 0group by type, nameorder by awe_allocated_mb descgo-- What is the total memory used by the clerks?--select (sum(multi_pages_kb)+SUM(virtual_memory_committed_kb)+SUM(awe_allocated_kb))/1024from sys.dm_os_memory_clerksgo---- Does this sync up with what the node thinks?--select SUM(virtual_address_space_committed_kb)/1024 as total_node_virtual_memory_mb,SUM(locked_page_allocations_kb)/1024 as total_awe_memory_mb,SUM(single_pages_kb)/1024 as total_single_pages_mb,SUM(multi_pages_kb)/1024 as total_multi_pages_mbfrom sys.dm_os_memory_nodeswhere memory_node_id != 64go---- Total memory used by SQL Server through SQLOS memory nodes-- including DAC node-- What takes up the rest of the space?select (SUM(virtual_address_space_committed_kb)+SUM(locked_page_allocations_kb)+SUM(multi_pages_kb))/1024 as total_sql_memusage_mbfrom sys.dm_os_memory_nodesgo-- -- Who are the biggest cache stores?select name, type, (SUM(single_pages_kb)+SUM(multi_pages_kb))/1024 as cache_size_mbfrom sys.dm_os_memory_cache_counterswhere type like 'CACHESTORE%'group by name, typeorder by cache_size_mb descgo---- Who are the biggest user stores?select name, type, (SUM(single_pages_kb)+SUM(multi_pages_kb))/1024 as cache_size_mbfrom sys.dm_os_memory_cache_counterswhere type like 'USERSTORE%'group by name, typeorder by cache_size_mb descgo---- Who are the biggest object stores?select name, type, (SUM(single_pages_kb)+SUM(multi_pages_kb))/1024 as cache_size_mbfrom sys.dm_os_memory_clerkswhere type like 'OBJECTSTORE%'group by name, typeorder by cache_size_mb descgoselect mc.type, mo.type from sys.dm_os_memory_clerks mcjoin sys.dm_os_memory_objects moon mc.page_allocator_address = mo.page_allocator_addressgroup by mc.type, mo.typeorder by mc.type, mo.typego--memory per instance SELECT	CASE counter_name 			WHEN 'Target Server Memory (KB)' THEN 'MemoryAssignedToSQLServer'			WHEN 'Total Server Memory (KB)' THEN 'MemoryUsedBySQLServer'		END AS Property,		(cntr_value/1024) AS Value_MBFROM	sys.dm_os_performance_countersWHERE	counter_name IN ('Target Server Memory (KB)','Total Server Memory (KB)')[/code]</description><pubDate>Wed, 02 Jan 2013 23:43:57 GMT</pubDate><dc:creator>Bhuvnesh</dc:creator></item><item><title>RE: Memory management in sqlserver.</title><link>http://www.sqlservercentral.com/Forums/Topic1402039-391-1.aspx</link><description>You can use the sys.dm_os_memory_clerks dynamic management view (DMV) to get detailed information about memory allocation by the server components in SQL Server 2005 and 2008.  Some of the DMVs provide similar data as the DBCC MEMORYSTATUS command, but their output is much more programmer friendly. You can also use the following DMVs for memory troubleshooting both in SQL Server 2005 and 2008: •sys.dm_exec_cached_plans•sys.dm_exec_query_memory_grants•sys.dm_exec_query_resource_semaphores•sys.dm_exec_requests•sys.dm_exec_sessions•sys.dm_os_memory_cache_entries There are several new DMVs in SQL Server 2008 which make us easier to gather memory diagnosis information. Below is a summary of these new DMVs for memory troubleshooting: •sys.dm_os_memory_brokers provides information about memory allocations using the internal SQL Server memory manager. The information provided can be useful in determining very large memory consumers. •sys.dm_os_memory_nodes and sys.dm_os_memory_node_access_stats provide summary information of the memory allocations per memory node and node access statistics grouped by the type of the page. This information can be used instead of running DBCC MEMORYSTATUS to quickly obtain summary memory usage. (sys.dm_os_memory_node_access_stats is populated under dynamic trace flag 842 due to its performance impact.) •sys.dm_os_nodes provides information about CPU node configuration for SQL Server. This DMV also reflects software NUMA (soft-NUMA) configuration. •sys.dm_os_sys_memory returns the system memory information. The ‘Available physical memory is low’ value in the system_memory_state_desc column is a sign of external memory pressure that requires further analysis.</description><pubDate>Wed, 02 Jan 2013 22:30:12 GMT</pubDate><dc:creator>Rama Chandra Gowtham. Peddada</dc:creator></item><item><title>RE: Memory management in sqlserver.</title><link>http://www.sqlservercentral.com/Forums/Topic1402039-391-1.aspx</link><description>Thanks for the reply.I am just having sqlserver instance level access and i dont have access to the node.Hence is there anyway to get the details with TSQL itself:1) Total memory allocated in the windows machine where a sqlserver instances are installed.-- Check for teh system info.---Any TSQL to get the value2) Total memory allocated to each sqlserver instances in the machine.-- Check server properties.---Do you mean to say max and min memory?Appriciate your help.Mithra.</description><pubDate>Wed, 02 Jan 2013 17:10:20 GMT</pubDate><dc:creator>Mithra</dc:creator></item><item><title>RE: Memory management in sqlserver.</title><link>http://www.sqlservercentral.com/Forums/Topic1402039-391-1.aspx</link><description>[quote][b]Mithra (1/2/2013)[/b][hr]Team,  I am looking for the TSQL to get the below details.1)Total memory allocated in the windows machine where a sqlserver instances are installed.2)Total memory allocated to each sqlserver instances in the machine.3)Current memory used by the perticular instance.4)History of memory usage by the instance.   I checked many of the sites and couldn't get the accurate value for the above.Could anyone help me in getting the above values ,so i can really confirm and implement the memory setting accuratly.Thanks in advance.Mithra.[/quote]1) Total memory allocated in the windows machine where a sqlserver instances are installed.--   Check for teh system info.2) Total memory allocated to each sqlserver instances in the machine.-- Check server properties.3) Current memory used by the perticular instance.-- Memory is dynamically allocated and withdrwan based on the activity and many other factors.    you need to traceout for a whole day memory usage and check for max used on a day.4)History of memory usage by the instance.-- If you are using sql 2005 or 2008 , you could check on instance resports--&amp;gt; memory consumption report</description><pubDate>Wed, 02 Jan 2013 14:50:00 GMT</pubDate><dc:creator>@SQLFRNDZ</dc:creator></item><item><title>Memory management in sqlserver.</title><link>http://www.sqlservercentral.com/Forums/Topic1402039-391-1.aspx</link><description>Team,  I am looking for the TSQL to get the below details.1)Total memory allocated in the windows machine where a sqlserver instances are installed.2)Total memory allocated to each sqlserver instances in the machine.3)Current memory used by the perticular instance.4)History of memory usage by the instance.   I checked many of the sites and couldn't get the accurate value for the above.Could anyone help me in getting the above values ,so i can really confirm and implement the memory setting accuratly.Thanks in advance.Mithra.</description><pubDate>Wed, 02 Jan 2013 12:32:52 GMT</pubDate><dc:creator>Mithra</dc:creator></item></channel></rss>