Best Practices for SQL Server



Sr. No.
SQL Best Practices
Reason
1
Enabling Trace Flags
Globally


1117
To Enable Data Files grow equally in case of Autogrow.

1118
To Reduce Allocation Contention on TempDb Database
when the TempDb database is heavily used.

4199
Enables all the fixes that were previously made for the
query processor under many Trace Flags.

834
All Buffer pool memory will be allocated during startup.
It Increases performance of queries.
2
Max Server memory
Its value should be kept 70-80% of physical memory. It sets the upper limit to the amount of memory used by the buffer pool of the database engine.
3
Min Server memory
It can be set to any mimimum value. . The buffer pool does not immediately acquire the amount of memory specified in min server memory. The buffer pool starts with only the memory required to initialize. As the Database Engine workload increases, it keeps acquiring the memory required to support the workload.
4
Backup Compression
should be enabled
By enabling backup compression disk space can be
saved as the size of backup file reduces.
5
TempDB as per cores
When the tempdb database is heavily used, SQL Server
may experience contention when it tries to allocate pages. As a general rule, if the number of logical processors is less than or equal to 8, use the same number of data files as logical processors. If the number of logical processors is greater than 8, use 8 data files and then if contention continues, increase the number of data files by multiples of 4. It “Load Balances” the thread.

1. Enabling TraceFlags:





2. Setting Server memory
sp_configure 'show advanced options',1
reconfigure

sp_configure 'max server memory (MB)',40960
reconfigure 

sp_configure 'min server memory (MB)',512
reconfigure 

3. Enable backup compression
sp_configure 'backup compression default',1
reconfigure 

4. Tempdb Contention
USE [master]
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev_1', FILENAME = N'H:\Tempdb\tempdev_1.ndf' , SIZE = 32768KB , FILEGROWTH = 153600KB )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev_2', FILENAME = N'H:\Tempdb\tempdev_2.ndf' , SIZE = 32768KB , FILEGROWTH = 153600KB )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev_3', FILENAME = N'H:\Tempdb\tempdev_3.ndf' , SIZE = 32768KB , FILEGROWTH = 153600KB )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev_4', FILENAME = N'H:\Tempdb\tempdev_4.ndf' , SIZE = 32768KB , FILEGROWTH = 153600KB )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev_5', FILENAME = N'H:\Tempdb\tempdev_5.ndf' , SIZE = 32768KB , FILEGROWTH = 153600KB )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev_6', FILENAME = N'H:\Tempdb\tempdev_6.ndf' , SIZE = 32768KB , FILEGROWTH = 153600KB )
GO
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev_7', FILENAME = N'H:\Tempdb\tempdev_7.ndf' , SIZE = 32768KB , FILEGROWTH = 153600KB )
GO







Name

Azure Backup Database Clustering Crash Dumps DBCC Deadlock Link Server Log Shipping Maintenance Migration Mirroring Monitoring Performance Tuning Permissions Post Installations Prerequisites Replication Restore Database SQL Installations SQL on Linux SQL Uninstallations SSIS T-SQL Windows Server
false
ltr
item
hybriddba.blogspot.com: Best Practices for SQL Server
Best Practices for SQL Server
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGW0bjnDgOo2hWsDHYK6QLbqKq6PAkAl4-g3_hN8G5kKqUeNU-iKkyW2jk_hjx0lF14uiF5acDexnxj8mz5-NguThyphenhyphenKOTZrhJwbiqqm6Sh6bkyH3fWK4gpzSww7eihqVXGCjCIZo-HvHhb/s1600/1579338342586560-0.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGW0bjnDgOo2hWsDHYK6QLbqKq6PAkAl4-g3_hN8G5kKqUeNU-iKkyW2jk_hjx0lF14uiF5acDexnxj8mz5-NguThyphenhyphenKOTZrhJwbiqqm6Sh6bkyH3fWK4gpzSww7eihqVXGCjCIZo-HvHhb/s72-c/1579338342586560-0.png
hybriddba.blogspot.com
https://hybriddba.blogspot.com/2018/05/best-practices-for-sql-server.html
https://hybriddba.blogspot.com/
https://hybriddba.blogspot.com/
https://hybriddba.blogspot.com/2018/05/best-practices-for-sql-server.html
true
7679493960263860249
UTF-8
Not found any posts Not found any related posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU Tag ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Contents See also related Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy