Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Configuring SQL Server
I have been started with computers. 
I started my professional carrier in computers industry. 
I have been started to work...
SQL Server Configuration Checklist
Choosing Windows OS 
Windows Server 2012 R2 
Highly recommended especially for server than need to be highly available. ...
Apply patches and hotfixes on WinOS 
If you plan to use AlwaysOnAG it is important to apply the following patches 
Windo...
Configure the Windows page file 
SQL Server does not need a giant page file 
If SQL Server is the major service on the b...
Use Anti-Virus when… 
The servers is public on the Internet. 
The server have open ports to servers that are not behind ...
Setting Anti-Virus exclusions 
Directories of SQL Server instance 
SQL Server data files 
SQL Server backup files 
Ful...
Use RAID 
Minimum RAID 1 for all drives 
Including OS system drive 
Even SSD or PCI-Express 
RAID 10 for best performa...
Disk Drive Format 
OS System drive should be formatted with the default (4K) cluster size. 
All drives holding data & lo...
Power Option 
Confirmthatthe Windows powerplanissettohighperformance 
Confirmthatthe processorsarerunningat fullspeedusi...
Use Multiple Physical Network Cards when 
The connectivity with SQL Server is important! 
You have Failover clustering o...
Use separate drive for 
SQL Server application folders 
SQL Server database data files 
SQL Server database log file 
...
SQL Server servicesaccounts 
Use dedicateddomainuseraccountwithnospecialrightson the domain. 
Youdonotneedorwantthisacco...
Policy Settingsand Rights for the SQL Server serviceaccount 
Enable Instant File Initialization 
Perform Volume Maintena...
SQL Server Installation 
Installonlythe featuresyouactuallyneed 
This willreduceyourattacksurface 
It willspeedfuturema...
Trace Flags to enable 
1118 
This trace flag switches allocations in tempdbfrom single-page at a time for the first 8 pa...
Server Properties 
Enable compressed backups 
Setting Default backup media retention (days) 
Setting Database default l...
Server Properties 
Max Worker Threads 
Priority Boost 
Lightweight Pooling 
Maximum number of concurrent connections 
...
SQL Server Memory 
Set Max Server Memory 
Importantwhen LPIMis enabled 
Use this formula to calculate SQL Server Memory...
Tweak Model database 
Change the default size for data and log files 
Change the file growth to fixed units
Configure TempDB 
Move TempDBto its own drive 
Grow the size of data file 
Add additional data files as the number of l...
Configure MAXDOP 
Set this to the number of physical cores in a single NUMA node socket on your hardware or less 
Always...
Cost Threshold of Parallelism 
General defaultvalueof 5 islowfor mostOLTP workloadsand shouldbeincreased. 
Basevalueof 2...
Optimize for Ad-hoc workloads 
Controlthe amountof memory thatisusedbysingle-use, ad hoc queryplansin the plancache. 
SQ...
SQL Server Network Connectivity 
Enable TCP/IP 
Firewall exceptions 
TCP port of instance 
UTP 1434 for SQL Browser
Configure Alerting and Monitoring 
Configure Database Mail 
Create Operators 
Configure SQL Agent to use Database Mail ...
Create Database 
Don’t use the default file size 
Don’t use presentence as file growth 
Pay attention on T-Log size and...
Database Properties 
Don’t set Auto Close 
Don’t set Auto Shrink 
Don’t unset Auto Create/Update Statistics
ANSI_NULLS 
Determine comparison evaluations. 
When set to ON all comparison to a null value evaluate to UNKNOWN 
When ...
ANSI_PADDING 
When set to ON data stored in char, varchar, binary, varbinarydata types retain any padded zeros 
To the l...
INSTEAD OF Triggers 
Instead Of triggers can be nested regardless of the setting of Nested triggers option
help@sqlschool.gr
Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014
Upcoming SlideShare
Loading in …5
×

Configuring sql server - SQL Saturday, Athens Oct 2014

1,291 views

Published on

Configuring sql server

Published in: Technology
  • Login to see the comments

Configuring sql server - SQL Saturday, Athens Oct 2014

  1. 1. Configuring SQL Server
  2. 2. I have been started with computers. I started my professional carrier in computers industry. I have been started to work with SQL Server version 6.0 I earned my first certification at Microsoft as Microsoft Certified Solution Developer (3rd in Greece) and started my carrier as Microsoft Certified Trainer (MCT) with more than 20.000 hours of training until now! I became for first time Microsoft MVP on SQL Server I created the SQL School Greece (www.sqlschool.gr) I became MCT Regional Lead by Microsoft Learning Program. I was certified as MCSE : Data Platform, MCSE: Business Intelligence Antonios Chatzipavlis Solution Architect • SQL Server Evangelist • Trainer • Speaker MCT, MCSE, MCITP, MCPD, MCSD, MCDBA, MCSA, MCTS, MCAD, MCP, OCA, ITIL-F  1982  1988  1996  1998  2010  2012  2013
  3. 3. SQL Server Configuration Checklist
  4. 4. Choosing Windows OS Windows Server 2012 R2 Highly recommended especially for server than need to be highly available. Avoid Windows Server 2008 R2 and older versions
  5. 5. Apply patches and hotfixes on WinOS If you plan to use AlwaysOnAG it is important to apply the following patches Windows Server 2008 R2 SP1 –KB2545685 Windows Server 2012 –KB2784261 Windows Server 2012 R2 –KB2920151 Prerequisites, Restrictions, and Recommendations for AlwaysOnAvailability Groups
  6. 6. Configure the Windows page file SQL Server does not need a giant page file If SQL Server is the major service on the box a 2GB page file on system drive it’s enough Beware removing the page file (KB254649)
  7. 7. Use Anti-Virus when… The servers is public on the Internet. The server have open ports to servers that are not behind a firewall. The server read or execute files from other servers. The server run HTTP servers The server hosting file shares. The server use Database Mail to handle incoming or outgoing email messages.
  8. 8. Setting Anti-Virus exclusions Directories of SQL Server instance SQL Server data files SQL Server backup files Full-Text catalog files Trace files SQL audit files SQL query files SQL Server service
  9. 9. Use RAID Minimum RAID 1 for all drives Including OS system drive Even SSD or PCI-Express RAID 10 for best performance Use 128GB drive for OS system drive Test the I/O performanceSQLIO/SQLIOSIM
  10. 10. Disk Drive Format OS System drive should be formatted with the default (4K) cluster size. All drives holding data & log files should be formatted with 64K cluster size Check your storage for partition alignment Follow this rule even if it’s a VM on shared storage
  11. 11. Power Option Confirmthatthe Windows powerplanissettohighperformance Confirmthatthe processorsarerunningat fullspeedusingCPU-Z
  12. 12. Use Multiple Physical Network Cards when The connectivity with SQL Server is important! You have Failover clustering or Availability Groups It’s a good practice even for standalone server Teaming NICs
  13. 13. Use separate drive for SQL Server application folders SQL Server database data files SQL Server database log file including TempDB TempDBdata files Backups
  14. 14. SQL Server servicesaccounts Use dedicateddomainuseraccountwithnospecialrightson the domain. Youdonotneedorwantthisaccounttobea localadminon the machinewhereSQL Server willbeinstalled. Use a separate, dedicateddomainuseraccountfor the SQL Server Agentservice. Ifyouaregoingtobeinstallingand usingotherSQL Server relatedservices, youwillwantdedicateddomainaccountsfor eachservice.
  15. 15. Policy Settingsand Rights for the SQL Server serviceaccount Enable Instant File Initialization Perform Volume Maintenance Tasks Grant Lockpagesin memory Common on SQL Server 2005 / Windows 2003 Lesscommonwithnewerversions (Stillitisa goodideatoenableLPIM on a newsystem) Addthe permissionstothe Service Accountin AD-KB319723 readServicePrincipalName writeServicePrincipalName
  16. 16. SQL Server Installation Installonlythe featuresyouactuallyneed This willreduceyourattacksurface It willspeedfuturemaintenanceof the instancebecausetherearefewercomponentstopatch Install Services Packs or CUs Entera strong passwordfor the saaccountif youchooseMixedModeauthentication Set the DataDirectoriesaccording to plan Do not use C: drive
  17. 17. Trace Flags to enable 1118 This trace flag switches allocations in tempdbfrom single-page at a time for the first 8 pages, to immediately allocate an extent (8 pages). 2371 that you can use to control when the query optimizer generates autostatson a table
  18. 18. Server Properties Enable compressed backups Setting Default backup media retention (days) Setting Database default location for Data files Log files Backups
  19. 19. Server Properties Max Worker Threads Priority Boost Lightweight Pooling Maximum number of concurrent connections Network Packet Size
  20. 20. SQL Server Memory Set Max Server Memory Importantwhen LPIMis enabled Use this formula to calculate SQL Server Memory Reserve 1GB for OS Reserve 1GB for each 4GB after the first 4GB and until 16GB Reserve 1GB for each 8GB after the first 16GB Monitor the Memory:AvailableMB performance counter Server Memory 64GB 1GB for OS 3GB for 4-16GB 6GB for 16-64GB 10GB in total 64-10 = 54 Max SQL Server memory
  21. 21. Tweak Model database Change the default size for data and log files Change the file growth to fixed units
  22. 22. Configure TempDB Move TempDBto its own drive Grow the size of data file Add additional data files as the number of logical processors up to 8 logical CPUs Each file must have the same size Pre-allocate the space. KB2154845
  23. 23. Configure MAXDOP Set this to the number of physical cores in a single NUMA node socket on your hardware or less Always use an even value Use the value of 1 only of you have specific vendor requirements SharePoint BizTalk SAP KB2806353
  24. 24. Cost Threshold of Parallelism General defaultvalueof 5 islowfor mostOLTP workloadsand shouldbeincreased. Basevalueof 20-25 usedfor mostserverinstalls.
  25. 25. Optimize for Ad-hoc workloads Controlthe amountof memory thatisusedbysingle-use, ad hoc queryplansin the plancache. SQL Server storeonlya smallstubof anad hoc queryplanin the plancachethe firsttimethatthe ad hoc planisexecuted Reducesthe memory requiredfor thatplanin the plancache. It’s nota panaceafor single-usead hoc queryplans http://www.sqlschool.gr/blog/do-you-have-optimize- for-ad-hoc-workloads-on-sql-server-2008-r2- instances-380.aspx
  26. 26. SQL Server Network Connectivity Enable TCP/IP Firewall exceptions TCP port of instance UTP 1434 for SQL Browser
  27. 27. Configure Alerting and Monitoring Configure Database Mail Create Operators Configure SQL Agent to use Database Mail Create Alerts for Severity 16 to 25 Create Alerts for Errors 823, 824, 825 AddingOla Hallengren’sMaintenanceSolution Install Adam Machanicsp_WhoIsActive Install and run Brent Ozarsp_Blitz
  28. 28. Create Database Don’t use the default file size Don’t use presentence as file growth Pay attention on T-Log size and growth to produce equal VLFs Use more than one filegroups In PRIMARY leave system object Put all user objects to another filegroup Use more than one data files Even this are in the same drive
  29. 29. Database Properties Don’t set Auto Close Don’t set Auto Shrink Don’t unset Auto Create/Update Statistics
  30. 30. ANSI_NULLS Determine comparison evaluations. When set to ON all comparison to a null value evaluate to UNKNOWN When set to OFF all comparison to a null value evaluate to TRUE if both values are NULL The default value is OFF This option is deprecated and will always be ON in a future version of SQL Server
  31. 31. ANSI_PADDING When set to ON data stored in char, varchar, binary, varbinarydata types retain any padded zeros To the left of variable binary Left and Right of variable length characters The default is OFF This option is deprecated and will always be ON in a future version of SQL Server
  32. 32. INSTEAD OF Triggers Instead Of triggers can be nested regardless of the setting of Nested triggers option
  33. 33. help@sqlschool.gr

×