gggggds 发表于 2016-10-31 10:10:17

[sql server] 服务器的设置

  -- 1 内存篇
  -- 设置使用 AWE 分配内存
EXEC sys.sp_configure N'awe enabled', N'1'
GO
RECONFIGURE WITH OVERRIDE
  -- 设置最小服务器内存 50M
EXEC sys.sp_configure N'min server memory (MB)', N'50'
GO
RECONFIGURE WITH OVERRIDE
GO
  -- 设置最大服务器内存 2147483647M
EXEC sys.sp_configure N'max server memory (MB)', N'2147483647'
GO
RECONFIGURE WITH OVERRIDE
GO
  -- 创建索引占用的内存
EXEC sys.sp_configure N'index create memory (KB)', N'0'
GO
RECONFIGURE WITH OVERRIDE
GO
  -- 设置每次查询占用的最小内存
EXEC sys.sp_configure N'min memory per query (KB)', N'1024'
GO
RECONFIGURE WITH OVERRIDE
GO
  -- 2 cpu 篇
  -- 设置 cpu 关联
EXEC sys.sp_configure N'affinity mask', N'1'
GO
RECONFIGURE WITH OVERRIDE
GO
  -- 设置 I/O 关联
EXEC sys.sp_configure N'affinity I/O mask', N'2'
GO
RECONFIGURE WITH OVERRIDE
GO
  -- 设置 cpu 最大线程
EXEC sys.sp_configure N'max worker threads', N'128'
GO
RECONFIGURE WITH OVERRIDE
GO
  -- 设置 cpu 最大线程
EXEC sys.sp_configure N'max worker threads', N'128'
GO
RECONFIGURE WITH OVERRIDE
GO
  -- 提升 sql server 优先级
EXEC sys.sp_configure N'priority boost', N'1'
GO
RECONFIGURE WITH OVERRIDE
GO
  
-- 安全性篇
  -- 修改服务器登陆验证模式 1-windows 身份验证模式;2-Sql Server 和 windows 身份验证模式
USE
GO
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software/Microsoft/MSSQLServer/MSSQLServer', N'LoginMode', REG_DWORD, 1
GO
  后续
页: [1]
查看完整版本: [sql server] 服务器的设置