关键词搜索

源码搜索 ×
×

SQLServer内存配置操作

发布2022-06-13浏览2164次

详情内容

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

原文地址:Server memory configuration options - SQL Server | Microsoft Docs

核心的语句处理:

  1. -- A 设置内存为4GB
  2. sp_configure 'show advanced options', 1;
  3. GO
  4. RECONFIGURE;
  5. GO
  6. sp_configure 'max server memory', 4096;
  7. GO
  8. RECONFIGURE;
  9. GO
  10. -- B 确定当前内存分配
  11. SELECT
  12. physical_memory_in_use_kb/1024 AS sql_physical_memory_in_use_MB,
  13. large_page_allocations_kb/1024 AS sql_large_page_allocations_MB,
  14. locked_page_allocations_kb/1024 AS sql_locked_page_allocations_MB,
  15. virtual_address_space_reserved_kb/1024 AS sql_VAS_reserved_MB,
  16. virtual_address_space_committed_kb/1024 AS sql_VAS_committed_MB,
  17. virtual_address_space_available_kb/1024 AS sql_VAS_available_MB,
  18. page_fault_count AS sql_page_fault_count,
  19. memory_utilization_percentage AS sql_memory_utilization_percentage,
  20. process_physical_memory_low AS sql_process_physical_memory_low,
  21. process_virtual_memory_low AS sql_process_virtual_memory_low
  22. FROM sys.dm_os_process_memory;
  23. -- C 查询最大服务器内存设置
  24. SELECT [value],[value_in_use]
  25. FROM sys.configurations WHERE [name] = 'max server memory (MB)';

相关技术文章

点击QQ咨询
开通会员
返回顶部
×
微信扫码支付
微信扫码支付
确定支付下载
请使用微信描二维码支付
×

提示信息

×

选择支付方式

  • 微信支付
  • 支付宝付款
确定支付下载