[sql server] 服务器的设置

本文档提供了一系列针对SQL Server的性能调优配置方法,包括内存、CPU和安全性方面的设置,如调整最大和最小服务器内存、设置索引创建内存、配置CPU核心绑定及优先级等。

-- 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 [master]
GO
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software/Microsoft/MSSQLServer/MSSQLServer', N'LoginMode', REG_DWORD, 1
GO

后续

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值