千家信息网

SQL Server数据库配置改进

发表于:2025-11-12 作者:千家信息网编辑
千家信息网最后更新 2025年11月12日,针对SQL Server数据库的配置,遵从最佳实践,有如下几项,看能否修改生产环境实例配置。以下为调整方法和依据:启动账号内存锁定保证SQL Server提交内存不会被交换或空间被操作系统收缩。The
千家信息网最后更新 2025年11月12日SQL Server数据库配置改进

针对SQL Server数据库的配置,遵从最佳实践,有如下几项,看能否修改生产环境实例配置。




以下为调整方法和依据:

启动账号内存锁定

保证SQL Server提交内存不会被交换或空间被操作系统收缩。

The SQL Server 64-bit version uses "locked pages" to prevent the process working set (committed memory) from being paged out or trimmed by the operating system.

参考:

https://support.microsoft.com/en-us/kb/2659143

限制最大内存大小

保留一定内存供SQL Server连接内存、其它应用、系统内存等使用。

参考:

https://mssqlwiki.com/2013/04/22/max-server-memory-do-i-need-to-configure/

启动帐号即时文件初始化

快速初始化数据文件空间分配,减少等待。

This should be enabled in the vast majority of cases. SQL Server 2016 lets you enable this during the SQL server installation process.

参考:

Database Instant File Initialization

https://docs.microsoft.com/en-us/sql/relational-databases/databases/database-instant-file-initialization

Misconceptions around instant file initialization

https://www.sqlskills.com/blogs/paul/misconceptions-around-instant-file-initialization/

tempdb根据CPU核数配置多个文件

根据CPU核数配置多个相同配置的tempdb文件,提高tempdb的访问性能,已成为SQL Server 2016的标配。

参考:

https://www.derekseaman.com/2014/09/sql-2014-always-ag-pt-7-tempdb.html

https://blogs.msdn.microsoft.com/psssql/2016/03/17/sql-2016-it-just-runs-faster-automatic-tempdb-configuration/

https://blogs.sentryone.com/aaronbertrand/sql-server-2016-tempdb-fixes/

Trace Flag放到启动参数中

跟踪标志用于开启特定功能提高数据库性能。

Common trace flags that should be enabled in most cases

TF 1117 - When growing a data file, grow all files at the same time so they remain the same size, reducing allocation contention points

参考:

http://support2.microsoft.com/kb/2154845

TF 1118 - Helps alleviate allocation contention in tempdb, SQL Server allocates full extents to each database object, thereby eliminating the contention on SGAM pages (more important with older versions of SQL Server). Recommendations to reduce allocation contention in SQL Server tempdb database

参考:

http://support2.microsoft.com/kb/2154845

TF 2371 - Lowers auto update statistics threshold for large tables.

参考:

http://blogs.msdn.com/b/saponsqlserver/archive/2011/09/07/changes-to-automatic-update-statistics-in-sql-server-traceflag-2371.aspx

TF 3226 - Supresses logging of successful database backup messages to the SQL Server Error Log.

参考:

https://www.sqlskills.com/blogs/paul/fed-up-with-backup-success-messages-bloating-your-error-logs/

optimize for ad hoc workloads

优化即系查询的内存占用。

参考:

https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/optimize-for-ad-hoc-workloads-server-configuration-option

https://www.red-gate.com/simple-talk/blogs/using-optimize-for-ad-hoc-workloads/

remote admin connections

数据库有性能瓶颈时提供远程管理访问连接。

参考:

https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/remote-admin-connections-server-configuration-option

https://www.brentozar.com/archive/2011/08/dedicated-admin-connection-why-want-when-need-how-tell-whos-using/




参考 内存 配置 数据 文件 数据库 性能 多个 核数 空间 系统 最大 相同 操作系统 功能 参数 大小 实例 方法 标志 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 软件开发培训学校不 金盛互娱的软件开发商是哪家 计算机网络技术教材高职 奉贤区推广软件开发厂家规定 软件开发时期主要包括 利用队列和临床数据库开展研究 北京思派网络技术有限公司 传统公司做软件开发 吉林省国开网络技术有限公司 数据库防伪技术推荐厂家 建信人寿安徽软件开发 无锡应用软件开发客户至上 共享服务器找不到域位置 软件开发平台的策划书 金融网络安全演讲 黄沙租房软件开发 数据安全吗服务器在哪里 国家网络安全周视频 交通运输部干部管理学院网络安全 山东济南服务器代理哪家好云主机 做软件测试数据库要学多深 手机基岩版服务器进不去 t1飞跃普及版数据库 服务器安全防护软件评测推荐 为什么车辆定位服务器升级中 汉王人脸考勤机修改数据库 网络科技和互联网科技区别 数据库技术及开发教程 一个软件开发公司的职务 qt怎样关闭数据库
0