fly'sBlog

导航

SQLServer内存配置操作

SqlServer的内存使用默认大小无限制,有些场景下导致服务内存被全部打满,影响服务器性能。


 -- A 设置内存为90GB
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'max server memory', 92400;
GO
RECONFIGURE;
GO
 
 
-- B 确定当前内存分配
SELECT
  physical_memory_in_use_kb/1024 AS sql_physical_memory_in_use_MB,
   large_page_allocations_kb/1024 AS sql_large_page_allocations_MB,
   locked_page_allocations_kb/1024 AS sql_locked_page_allocations_MB,
   virtual_address_space_reserved_kb/1024 AS sql_VAS_reserved_MB,
   virtual_address_space_committed_kb/1024 AS sql_VAS_committed_MB,
   virtual_address_space_available_kb/1024 AS sql_VAS_available_MB,
   page_fault_count AS sql_page_fault_count,
   memory_utilization_percentage AS sql_memory_utilization_percentage,
   process_physical_memory_low AS sql_process_physical_memory_low,
   process_virtual_memory_low AS sql_process_virtual_memory_low
FROM sys.dm_os_process_memory;
 
-- C 查询最大服务器内存设置
SELECT [value],[value_in_use]
FROM sys.configurations WHERE [name] = 'max server memory (MB)';


posted on 2023-06-05 10:28  fly'sBlog  阅读(224)  评论(0编辑  收藏  举报