SlideShare una empresa de Scribd logo
1 de 19
SQL Server Best Practices
Install SQL Server like a boss
Andre Essing
1
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017
The Key for a Perfect System
• Balanced system without bottlenecks
• SQL Server is only a small part
• Plan your system before you build it
Processor Memory Storage HBA Networking
2
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017
Andre Essing
Technology Solutions Professional
Microsoft Deutschland GmbH
Andre advises, in his role as Technology Solutions
Professional, customers in topics all around the
Microsoft Data Platform. He is specialized in mission
critical systems, high-availability, security, operating
and of course the cloud.
/aessing @aessing aessingandre.essing@microsoft.com /Andre_Essing
3
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017
Pre-Deployment
4
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017
Hardware & Storage
• Use the optimal storage
• Handle volumes the right way
• Implement a good disk layout
• Do backups remotely
• Don’t save power
▪ Use the right storage
▪ HDD, SSD or Flash
▪ RAID Level
▪ Direct Attached or SAN
▪ iSCSI or FibreChannel
▪ Read caching isn’t necessary, SQL Server does the buffering
▪ Prefer more smaller disks than one large
▪ Low latency (Disk Access) is important
▪ Don’t use thin provisioning
▪ Handle volumes the right way
▪ Check partition alignment
http://msdn.microsoft.com/en-us/library/dd758814.aspx
▪ Format volumes the right way
▪ NTFS, 64KB, no quick format
▪ Disable file indexing and automatic defragmentation
▪ Implement a good disk layout
▪ Use more than one disks
▪ Separate disks for data, transaction log and TempDB
▪ Use mountpoints
▪ Consider max IOPs / size per disk
▪ Do backups remotely
▪ Consider a remote backup location
▪ UNC Path works great
5
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017
▪ Backup to Azure Blob Storage as offsite backup
▪ Don’t save power
▪ Disable power savings everywhere
SQL Server Best Practices
SQL Server Konferenz 2017 14.02.2017
5
Operating System
• Performance is important
• Don’t forget about security…
• … and the user permissions
• Just in case, I talk about Windows here
▪ Performance is important
▪ Set power plan to high performance
▪ Check what’s better: Hyperthreading off or on
▪ Don’t forget about security…
▪ Antivirus software & exclusions
https://support.microsoft.com/en-us/kb/309422
▪ Windows Firewall & User Access Control is a good thing, enable them
▪ A server is not a workstation, so don’t use it as one
▪ Think about Windows Server Core for SQL Server installations
▪ … and the user permissions
▪ Local Security Policy -> SQL Server Service account rights are a must have
▪ Lock Pages In Memory
▪ Perform Volume Maintenance Tasks
6
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017
Setup
7
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017
Installation
• How much SQL you need
• Don’t repeat yourself
• Security… again!
• A server is not a workstation
▪ How much SQL you need
▪ Only install components you really need
▪ Choose the correct collation
▪ Don’t repeat yourself
▪ Install using a configuration file
▪ Security… again!
▪ Don‘t forget to install updates
▪ Use Service Accounts instead of “Local System”
▪ BUILTINAdministrators isn’t a good idea for SQL Server DBAs
▪ Use a domain group for DBAs only
▪ A server is not a workstation
8
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017
Post-Deployment
9
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017
Instance
• Make it easy to connect
• Security… again… are you kidding?
• Perhaps, Trace Flags
• Instance Settings
▪ Make it easy to connect
▪ Use same port for all instances / availability groups
▪ Easier for migrations
▪ Easier to remember
▪ Use DNS alias for easy access
▪ Use A-Records to avoid problems with Kerberos Auth
▪ Transparent access for the users
▪ No application changes on migrations and database moves
▪ Security… again… are you kidding?
▪ Don’t use SQL Logins, Windows Auth is more secure
▪ Set SPNs to use Kerberos authentication with Windows Auth
▪ Perhaps, Trace Flags
▪ Trace Flag 1117
▪ Equally grows all data files
▪ Replaced in 2016 by filegroup option
(AUTOGROW_ALL_FILES - sys.filegroups)
▪ Recommended for all filegroups and databases
▪ Trace Flag 1118
▪ Force use of unified extents for objects
▪ Replaced in 2016 by database option
(MIXED_PAGE_ALLOCATION - sys.databases)
▪ Default in SQL Server 2016 for new databases
▪ Instance Settings
10
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017
▪ Configure memory limits, especially “max server memory“
▪ Enable “Optimize for ad hoc workloads”
▪ Configure Max Degree of Parallelism
▪ Not higher than cores per socket / NUMA Node
▪ Some apps need a value of 1, check documentation
▪ Configure Cost Threshold for Parallelism
▪ Good start value for OLTP workloads: 40
▪ Good start value for DWH and mixed workloads: 25
SQL Server Best Practices
SQL Server Konferenz 2017 14.02.2017
10
TempDB
• Split into multiple files
• Size and growth does matter
• Keep an eye on it
• Before SQL 2016, remember the Trace Flags
▪ Split into multiple files
▪ There are a lot of complicated rules out there
▪ Just use TempDB with 8 files, more usually achieve no big advantage
▪ Always 8 files is easier to maintain
▪ In some rare cases more then 8 files brings some advantage
▪ Size and growth does matter
▪ Size depends on TempDB usage
▪ Monitor old system, ask the vendor or guess
▪ Start with 2GB per data file and 8GB log (if you don’t know)
▪ Growth: 256MB for data and 1GB for log
▪ Keep an eye on it
▪ Monitor TempDB usage
▪ If TempDB grows, set new size as initial size (include a buffer)
▪ Before SQL 2016, remember the Trace Flags
▪ Set Trace Flag 1117 and 1118
11
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017
Database
• Take care of the defaults
• Keep as reliable as you can
• The physical design matters
• Don’t mess-up with the security
▪ Take care of the defaults
▪ Set the default fill factor
▪ 0 means 100%
▪ Best practice is 70% or 80%
▪ The setting is just for “new” objects
▪ Keep an eye on fragmentation
▪ Never enable Auto_Close or Auto_Shrink
▪ It always leads you into performance issues
▪ With Auto_Shrink enabled, disk fragmentation is your new friend ;o)
▪ Enable Auto_Create_Statistics and Auto_Update_Statistics
▪ Most database haven’t the right statistics implemented
▪ Normally the settings increase the speed of your queries
▪ Should be enabled if not forbidden by the software vendor
▪ Keep as reliable as you can
▪ Always use Full Recovery Model, without exception
▪ For temporary databases and staging databases the Single Recovery Model is ok
▪ Usually reliability is more important than speed
▪ Don’t be afraid, using Full Recovery Model is easier than it sounds
▪ Don’t forget to do transaction log backups
▪ The physical design matters
▪ When possible, primary filegroup only for MDF
▪ Create extra filegroups for your data
▪ If not possible, just add files to primary filegroup
▪ Start with 4 files per filegroup
▪ Set size and growth of files
▪ Estimate the database size for the next year(s)
12
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017
▪ The files shouldn’t grow automatically
▪ Keep autogrowth enabled for safety reasons
▪ 256MB autogrowth for data and 1GB for log
▪ Keep an eye on VLFs
▪ DBCC LOGINFO
▪ Don’t mess-up with the security
▪ Don’t assign DB_Owner role to users
▪ Build user roles with the right permissions instead
▪ Don’t assign the dbo to a normal user
▪ Assign to sa or to special login
SQL Server Best Practices
SQL Server Konferenz 2017 14.02.2017
12
Maintenance
• Don’t forget instance and database maintenance
• Backup checksum and compression
• Don‘t do plans, script the tasks
• Never shrink during maintenance
▪ Don’t forget instance and database maintenance
▪ Daily Backups (Full and perhaps differential)
▪ Transaction log backups (every 5 – 15 minutes)
▪ Integrity checks (daily)
▪ Index reorganize or rebuild (daily)
▪ Update statistics (daily)
▪ Clean up backup and job history (daily)
▪ Cleanup mail items (daily)
▪ Backup checksum and compression
▪ Enable Compress Backups by default
▪ Saves I/O and disk space
▪ Faster backups
▪ A bit more CPU usage during backup
▪ No reason to not turn it on
▪ Checksum default
▪ No GUI, not documented, but ok to use
▪ EXEC sp_configure ‘backup checksum default’, 1; GO RECONFIGURE
WITH OVERRIDE; GO
▪ No reason to not turn it on
▪ Don‘t do plans, script the tasks
▪ Don’t use maintenance plans
▪ Scripts are…
▪ …better reuseable
▪ …more flexible
▪ …more intelligent
▪ Use maintenance scripts
13
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017
▪ Ola Hallengren (https://ola.hallengren.com/)
▪ or from other vendors
▪ or build your own
▪ Never shrink during maintenance
▪ Same problems as AUTO_SHRINK
SQL Server Best Practices
SQL Server Konferenz 2017 14.02.2017
13
Questions & answers…
14
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017
15
14.02.2017
SQL Server Best Practices
SQL Server Konferenz 2017

Más contenido relacionado

La actualidad más candente

Next Generation Software-Defined Storage
Next Generation Software-Defined StorageNext Generation Software-Defined Storage
Next Generation Software-Defined StorageStorMagic
 
Why new hardware may not make Oracle databases faster
Why new hardware may not make Oracle databases fasterWhy new hardware may not make Oracle databases faster
Why new hardware may not make Oracle databases fasterSolarWinds
 
Building perfect sql servers, every time -oops
Building perfect sql servers, every time -oopsBuilding perfect sql servers, every time -oops
Building perfect sql servers, every time -oopsJoseph D'Antoni
 
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloudTobias Koprowski
 
KoprowskiT_SQLRelayBirmingham_SQLSecurityInTheClouds
KoprowskiT_SQLRelayBirmingham_SQLSecurityInTheCloudsKoprowskiT_SQLRelayBirmingham_SQLSecurityInTheClouds
KoprowskiT_SQLRelayBirmingham_SQLSecurityInTheCloudsTobias Koprowski
 
SQL Server Modernization
SQL Server ModernizationSQL Server Modernization
SQL Server ModernizationGianluca Hotz
 
Introduction to SQL Server Analysis services 2008
Introduction to SQL Server Analysis services 2008Introduction to SQL Server Analysis services 2008
Introduction to SQL Server Analysis services 2008Tobias Koprowski
 
SQLBits XIV - The Big Backup Theory
SQLBits XIV - The Big Backup TheorySQLBits XIV - The Big Backup Theory
SQLBits XIV - The Big Backup TheoryRichard Douglas
 
MySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsMySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsOSSCube
 
SOA Suite Administration from OUGN 2014
SOA Suite Administration from OUGN 2014SOA Suite Administration from OUGN 2014
SOA Suite Administration from OUGN 2014Jon Petter Hjulstad
 
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)Aurimas Mikalauskas
 
LVOUG meetup #2 - Forcing SQL Execution Plan Instability
LVOUG meetup #2 - Forcing SQL Execution Plan InstabilityLVOUG meetup #2 - Forcing SQL Execution Plan Instability
LVOUG meetup #2 - Forcing SQL Execution Plan InstabilityMaris Elsins
 
Windows 7 Feature Overview It Academic Day 2009
Windows 7 Feature Overview   It Academic Day 2009Windows 7 Feature Overview   It Academic Day 2009
Windows 7 Feature Overview It Academic Day 2009Tobias Koprowski
 
KoprowskiT_PASSEastMidsFEB16_2AMaDisasterJustBegan
KoprowskiT_PASSEastMidsFEB16_2AMaDisasterJustBeganKoprowskiT_PASSEastMidsFEB16_2AMaDisasterJustBegan
KoprowskiT_PASSEastMidsFEB16_2AMaDisasterJustBeganTobias Koprowski
 
Sql Server 2014 In Memory
Sql Server 2014 In MemorySql Server 2014 In Memory
Sql Server 2014 In MemoryRavi Okade
 
Microsoft Azure, My First IaaS
Microsoft Azure, My First IaaSMicrosoft Azure, My First IaaS
Microsoft Azure, My First IaaSJohn Martin
 
Novedades SQL Server 2014
Novedades SQL Server 2014Novedades SQL Server 2014
Novedades SQL Server 2014netmind
 
DB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource ManagerDB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource ManagerMaris Elsins
 
Always on in sql server 2017
Always on in sql server 2017Always on in sql server 2017
Always on in sql server 2017Gianluca Hotz
 
MySQL Enterprise Backup
MySQL Enterprise BackupMySQL Enterprise Backup
MySQL Enterprise BackupMario Beck
 

La actualidad más candente (20)

Next Generation Software-Defined Storage
Next Generation Software-Defined StorageNext Generation Software-Defined Storage
Next Generation Software-Defined Storage
 
Why new hardware may not make Oracle databases faster
Why new hardware may not make Oracle databases fasterWhy new hardware may not make Oracle databases faster
Why new hardware may not make Oracle databases faster
 
Building perfect sql servers, every time -oops
Building perfect sql servers, every time -oopsBuilding perfect sql servers, every time -oops
Building perfect sql servers, every time -oops
 
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#1_Reading_FromPlanToBackupToCloud
 
KoprowskiT_SQLRelayBirmingham_SQLSecurityInTheClouds
KoprowskiT_SQLRelayBirmingham_SQLSecurityInTheCloudsKoprowskiT_SQLRelayBirmingham_SQLSecurityInTheClouds
KoprowskiT_SQLRelayBirmingham_SQLSecurityInTheClouds
 
SQL Server Modernization
SQL Server ModernizationSQL Server Modernization
SQL Server Modernization
 
Introduction to SQL Server Analysis services 2008
Introduction to SQL Server Analysis services 2008Introduction to SQL Server Analysis services 2008
Introduction to SQL Server Analysis services 2008
 
SQLBits XIV - The Big Backup Theory
SQLBits XIV - The Big Backup TheorySQLBits XIV - The Big Backup Theory
SQLBits XIV - The Big Backup Theory
 
MySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsMySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 Tips
 
SOA Suite Administration from OUGN 2014
SOA Suite Administration from OUGN 2014SOA Suite Administration from OUGN 2014
SOA Suite Administration from OUGN 2014
 
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
 
LVOUG meetup #2 - Forcing SQL Execution Plan Instability
LVOUG meetup #2 - Forcing SQL Execution Plan InstabilityLVOUG meetup #2 - Forcing SQL Execution Plan Instability
LVOUG meetup #2 - Forcing SQL Execution Plan Instability
 
Windows 7 Feature Overview It Academic Day 2009
Windows 7 Feature Overview   It Academic Day 2009Windows 7 Feature Overview   It Academic Day 2009
Windows 7 Feature Overview It Academic Day 2009
 
KoprowskiT_PASSEastMidsFEB16_2AMaDisasterJustBegan
KoprowskiT_PASSEastMidsFEB16_2AMaDisasterJustBeganKoprowskiT_PASSEastMidsFEB16_2AMaDisasterJustBegan
KoprowskiT_PASSEastMidsFEB16_2AMaDisasterJustBegan
 
Sql Server 2014 In Memory
Sql Server 2014 In MemorySql Server 2014 In Memory
Sql Server 2014 In Memory
 
Microsoft Azure, My First IaaS
Microsoft Azure, My First IaaSMicrosoft Azure, My First IaaS
Microsoft Azure, My First IaaS
 
Novedades SQL Server 2014
Novedades SQL Server 2014Novedades SQL Server 2014
Novedades SQL Server 2014
 
DB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource ManagerDB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource Manager
 
Always on in sql server 2017
Always on in sql server 2017Always on in sql server 2017
Always on in sql server 2017
 
MySQL Enterprise Backup
MySQL Enterprise BackupMySQL Enterprise Backup
MySQL Enterprise Backup
 

Similar a SQL Server Best Practices for High Performance

Pre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyPre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyAntonios Chatzipavlis
 
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux AdminsLinuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux AdminsDave Stokes
 
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERAGeek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERAIDERA Software
 
The Peoper Care and Feeding of a MySQL Server for Busy Linux Admin
The Peoper Care and Feeding of a MySQL Server for Busy Linux AdminThe Peoper Care and Feeding of a MySQL Server for Busy Linux Admin
The Peoper Care and Feeding of a MySQL Server for Busy Linux AdminDave Stokes
 
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...Dave Stokes
 
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux AdministratorsProper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux AdministratorsDave Stokes
 
Get your SharePoint spinning with SQL Server
Get your SharePoint spinning with SQL ServerGet your SharePoint spinning with SQL Server
Get your SharePoint spinning with SQL ServerKnut Relbe-Moe [MVP, MCT]
 
SQLite3
SQLite3SQLite3
SQLite3cltru
 
Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014Antonios Chatzipavlis
 
Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11Jess Coburn
 
Running Oracle EBS in the cloud (DOAG TECH17 edition)
Running Oracle EBS in the cloud (DOAG TECH17 edition)Running Oracle EBS in the cloud (DOAG TECH17 edition)
Running Oracle EBS in the cloud (DOAG TECH17 edition)Andrejs Prokopjevs
 
Scalabe MySQL Infrastructure
Scalabe MySQL InfrastructureScalabe MySQL Infrastructure
Scalabe MySQL InfrastructureBalazs Pocze
 
SQL Server 2016 New Features and Enhancements
SQL Server 2016 New Features and EnhancementsSQL Server 2016 New Features and Enhancements
SQL Server 2016 New Features and EnhancementsJohn Martin
 
MariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & OptimizationMariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & OptimizationMariaDB plc
 
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...Knut Relbe-Moe [MVP, MCT]
 
MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!
MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!
MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!Tinku Ajit
 
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site ReviewECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site ReviewKenny Buntinx
 
SPSMadrid Get sql spinning with SharePoint. Best practice for the back end
SPSMadrid Get sql spinning with SharePoint. Best practice for the back endSPSMadrid Get sql spinning with SharePoint. Best practice for the back end
SPSMadrid Get sql spinning with SharePoint. Best practice for the back endKnut Relbe-Moe [MVP, MCT]
 
What I Learned About SQL Server at Ignite 2015
What I Learned About SQL Server at Ignite 2015What I Learned About SQL Server at Ignite 2015
What I Learned About SQL Server at Ignite 2015Brent Ozar
 
Operational foundation for the sql server dba
Operational foundation for the sql server dbaOperational foundation for the sql server dba
Operational foundation for the sql server dbaPeterShore4
 

Similar a SQL Server Best Practices for High Performance (20)

Pre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyPre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctly
 
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux AdminsLinuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
 
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERAGeek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
 
The Peoper Care and Feeding of a MySQL Server for Busy Linux Admin
The Peoper Care and Feeding of a MySQL Server for Busy Linux AdminThe Peoper Care and Feeding of a MySQL Server for Busy Linux Admin
The Peoper Care and Feeding of a MySQL Server for Busy Linux Admin
 
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
 
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux AdministratorsProper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
 
Get your SharePoint spinning with SQL Server
Get your SharePoint spinning with SQL ServerGet your SharePoint spinning with SQL Server
Get your SharePoint spinning with SQL Server
 
SQLite3
SQLite3SQLite3
SQLite3
 
Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014
 
Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11
 
Running Oracle EBS in the cloud (DOAG TECH17 edition)
Running Oracle EBS in the cloud (DOAG TECH17 edition)Running Oracle EBS in the cloud (DOAG TECH17 edition)
Running Oracle EBS in the cloud (DOAG TECH17 edition)
 
Scalabe MySQL Infrastructure
Scalabe MySQL InfrastructureScalabe MySQL Infrastructure
Scalabe MySQL Infrastructure
 
SQL Server 2016 New Features and Enhancements
SQL Server 2016 New Features and EnhancementsSQL Server 2016 New Features and Enhancements
SQL Server 2016 New Features and Enhancements
 
MariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & OptimizationMariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & Optimization
 
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
Unity Connect - Getting SQL Spinning with SharePoint - Best Practices for the...
 
MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!
MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!
MySQL Enterprise Backup: Better Very Large Database Backup & Recovery and More!!
 
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site ReviewECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
 
SPSMadrid Get sql spinning with SharePoint. Best practice for the back end
SPSMadrid Get sql spinning with SharePoint. Best practice for the back endSPSMadrid Get sql spinning with SharePoint. Best practice for the back end
SPSMadrid Get sql spinning with SharePoint. Best practice for the back end
 
What I Learned About SQL Server at Ignite 2015
What I Learned About SQL Server at Ignite 2015What I Learned About SQL Server at Ignite 2015
What I Learned About SQL Server at Ignite 2015
 
Operational foundation for the sql server dba
Operational foundation for the sql server dbaOperational foundation for the sql server dba
Operational foundation for the sql server dba
 

Más de Andre Essing

Ready for take-off - How to get your databases into the cloud
Ready for take-off - How to get your databases into the cloudReady for take-off - How to get your databases into the cloud
Ready for take-off - How to get your databases into the cloudAndre Essing
 
Azure Cosmos DB - Technical Deep Dive
Azure Cosmos DB - Technical Deep DiveAzure Cosmos DB - Technical Deep Dive
Azure Cosmos DB - Technical Deep DiveAndre Essing
 
Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...
Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...
Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...Andre Essing
 
SQL Server goes Linux - Hello, my name is Tux, I would like to join the #SQLF...
SQL Server goes Linux - Hello, my name is Tux, I would like to join the #SQLF...SQL Server goes Linux - Hello, my name is Tux, I would like to join the #SQLF...
SQL Server goes Linux - Hello, my name is Tux, I would like to join the #SQLF...Andre Essing
 
SQL Server und Azure: Impulse für die Modernisierung der IT-Strategie
SQL Server und Azure: Impulse für die Modernisierung der IT-StrategieSQL Server und Azure: Impulse für die Modernisierung der IT-Strategie
SQL Server und Azure: Impulse für die Modernisierung der IT-StrategieAndre Essing
 
SQL Server Monitoring - Piloten fliegen auch nicht blind
SQL Server Monitoring - Piloten fliegen auch nicht blindSQL Server Monitoring - Piloten fliegen auch nicht blind
SQL Server Monitoring - Piloten fliegen auch nicht blindAndre Essing
 
SQL Server Release Management - SPs, CUs und CODs, ich verstehe nur Bahnhof
SQL Server Release Management - SPs, CUs und CODs, ich verstehe nur BahnhofSQL Server Release Management - SPs, CUs und CODs, ich verstehe nur Bahnhof
SQL Server Release Management - SPs, CUs und CODs, ich verstehe nur BahnhofAndre Essing
 

Más de Andre Essing (7)

Ready for take-off - How to get your databases into the cloud
Ready for take-off - How to get your databases into the cloudReady for take-off - How to get your databases into the cloud
Ready for take-off - How to get your databases into the cloud
 
Azure Cosmos DB - Technical Deep Dive
Azure Cosmos DB - Technical Deep DiveAzure Cosmos DB - Technical Deep Dive
Azure Cosmos DB - Technical Deep Dive
 
Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...
Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...
Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...
 
SQL Server goes Linux - Hello, my name is Tux, I would like to join the #SQLF...
SQL Server goes Linux - Hello, my name is Tux, I would like to join the #SQLF...SQL Server goes Linux - Hello, my name is Tux, I would like to join the #SQLF...
SQL Server goes Linux - Hello, my name is Tux, I would like to join the #SQLF...
 
SQL Server und Azure: Impulse für die Modernisierung der IT-Strategie
SQL Server und Azure: Impulse für die Modernisierung der IT-StrategieSQL Server und Azure: Impulse für die Modernisierung der IT-Strategie
SQL Server und Azure: Impulse für die Modernisierung der IT-Strategie
 
SQL Server Monitoring - Piloten fliegen auch nicht blind
SQL Server Monitoring - Piloten fliegen auch nicht blindSQL Server Monitoring - Piloten fliegen auch nicht blind
SQL Server Monitoring - Piloten fliegen auch nicht blind
 
SQL Server Release Management - SPs, CUs und CODs, ich verstehe nur Bahnhof
SQL Server Release Management - SPs, CUs und CODs, ich verstehe nur BahnhofSQL Server Release Management - SPs, CUs und CODs, ich verstehe nur Bahnhof
SQL Server Release Management - SPs, CUs und CODs, ich verstehe nur Bahnhof
 

Último

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Último (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

SQL Server Best Practices for High Performance

  • 1. SQL Server Best Practices Install SQL Server like a boss Andre Essing 1 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017
  • 2. The Key for a Perfect System • Balanced system without bottlenecks • SQL Server is only a small part • Plan your system before you build it Processor Memory Storage HBA Networking 2 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017
  • 3. Andre Essing Technology Solutions Professional Microsoft Deutschland GmbH Andre advises, in his role as Technology Solutions Professional, customers in topics all around the Microsoft Data Platform. He is specialized in mission critical systems, high-availability, security, operating and of course the cloud. /aessing @aessing aessingandre.essing@microsoft.com /Andre_Essing 3 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017
  • 4. Pre-Deployment 4 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017
  • 5. Hardware & Storage • Use the optimal storage • Handle volumes the right way • Implement a good disk layout • Do backups remotely • Don’t save power ▪ Use the right storage ▪ HDD, SSD or Flash ▪ RAID Level ▪ Direct Attached or SAN ▪ iSCSI or FibreChannel ▪ Read caching isn’t necessary, SQL Server does the buffering ▪ Prefer more smaller disks than one large ▪ Low latency (Disk Access) is important ▪ Don’t use thin provisioning ▪ Handle volumes the right way ▪ Check partition alignment http://msdn.microsoft.com/en-us/library/dd758814.aspx ▪ Format volumes the right way ▪ NTFS, 64KB, no quick format ▪ Disable file indexing and automatic defragmentation ▪ Implement a good disk layout ▪ Use more than one disks ▪ Separate disks for data, transaction log and TempDB ▪ Use mountpoints ▪ Consider max IOPs / size per disk ▪ Do backups remotely ▪ Consider a remote backup location ▪ UNC Path works great 5 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017
  • 6. ▪ Backup to Azure Blob Storage as offsite backup ▪ Don’t save power ▪ Disable power savings everywhere SQL Server Best Practices SQL Server Konferenz 2017 14.02.2017 5
  • 7. Operating System • Performance is important • Don’t forget about security… • … and the user permissions • Just in case, I talk about Windows here ▪ Performance is important ▪ Set power plan to high performance ▪ Check what’s better: Hyperthreading off or on ▪ Don’t forget about security… ▪ Antivirus software & exclusions https://support.microsoft.com/en-us/kb/309422 ▪ Windows Firewall & User Access Control is a good thing, enable them ▪ A server is not a workstation, so don’t use it as one ▪ Think about Windows Server Core for SQL Server installations ▪ … and the user permissions ▪ Local Security Policy -> SQL Server Service account rights are a must have ▪ Lock Pages In Memory ▪ Perform Volume Maintenance Tasks 6 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017
  • 8. Setup 7 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017
  • 9. Installation • How much SQL you need • Don’t repeat yourself • Security… again! • A server is not a workstation ▪ How much SQL you need ▪ Only install components you really need ▪ Choose the correct collation ▪ Don’t repeat yourself ▪ Install using a configuration file ▪ Security… again! ▪ Don‘t forget to install updates ▪ Use Service Accounts instead of “Local System” ▪ BUILTINAdministrators isn’t a good idea for SQL Server DBAs ▪ Use a domain group for DBAs only ▪ A server is not a workstation 8 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017
  • 10. Post-Deployment 9 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017
  • 11. Instance • Make it easy to connect • Security… again… are you kidding? • Perhaps, Trace Flags • Instance Settings ▪ Make it easy to connect ▪ Use same port for all instances / availability groups ▪ Easier for migrations ▪ Easier to remember ▪ Use DNS alias for easy access ▪ Use A-Records to avoid problems with Kerberos Auth ▪ Transparent access for the users ▪ No application changes on migrations and database moves ▪ Security… again… are you kidding? ▪ Don’t use SQL Logins, Windows Auth is more secure ▪ Set SPNs to use Kerberos authentication with Windows Auth ▪ Perhaps, Trace Flags ▪ Trace Flag 1117 ▪ Equally grows all data files ▪ Replaced in 2016 by filegroup option (AUTOGROW_ALL_FILES - sys.filegroups) ▪ Recommended for all filegroups and databases ▪ Trace Flag 1118 ▪ Force use of unified extents for objects ▪ Replaced in 2016 by database option (MIXED_PAGE_ALLOCATION - sys.databases) ▪ Default in SQL Server 2016 for new databases ▪ Instance Settings 10 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017
  • 12. ▪ Configure memory limits, especially “max server memory“ ▪ Enable “Optimize for ad hoc workloads” ▪ Configure Max Degree of Parallelism ▪ Not higher than cores per socket / NUMA Node ▪ Some apps need a value of 1, check documentation ▪ Configure Cost Threshold for Parallelism ▪ Good start value for OLTP workloads: 40 ▪ Good start value for DWH and mixed workloads: 25 SQL Server Best Practices SQL Server Konferenz 2017 14.02.2017 10
  • 13. TempDB • Split into multiple files • Size and growth does matter • Keep an eye on it • Before SQL 2016, remember the Trace Flags ▪ Split into multiple files ▪ There are a lot of complicated rules out there ▪ Just use TempDB with 8 files, more usually achieve no big advantage ▪ Always 8 files is easier to maintain ▪ In some rare cases more then 8 files brings some advantage ▪ Size and growth does matter ▪ Size depends on TempDB usage ▪ Monitor old system, ask the vendor or guess ▪ Start with 2GB per data file and 8GB log (if you don’t know) ▪ Growth: 256MB for data and 1GB for log ▪ Keep an eye on it ▪ Monitor TempDB usage ▪ If TempDB grows, set new size as initial size (include a buffer) ▪ Before SQL 2016, remember the Trace Flags ▪ Set Trace Flag 1117 and 1118 11 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017
  • 14. Database • Take care of the defaults • Keep as reliable as you can • The physical design matters • Don’t mess-up with the security ▪ Take care of the defaults ▪ Set the default fill factor ▪ 0 means 100% ▪ Best practice is 70% or 80% ▪ The setting is just for “new” objects ▪ Keep an eye on fragmentation ▪ Never enable Auto_Close or Auto_Shrink ▪ It always leads you into performance issues ▪ With Auto_Shrink enabled, disk fragmentation is your new friend ;o) ▪ Enable Auto_Create_Statistics and Auto_Update_Statistics ▪ Most database haven’t the right statistics implemented ▪ Normally the settings increase the speed of your queries ▪ Should be enabled if not forbidden by the software vendor ▪ Keep as reliable as you can ▪ Always use Full Recovery Model, without exception ▪ For temporary databases and staging databases the Single Recovery Model is ok ▪ Usually reliability is more important than speed ▪ Don’t be afraid, using Full Recovery Model is easier than it sounds ▪ Don’t forget to do transaction log backups ▪ The physical design matters ▪ When possible, primary filegroup only for MDF ▪ Create extra filegroups for your data ▪ If not possible, just add files to primary filegroup ▪ Start with 4 files per filegroup ▪ Set size and growth of files ▪ Estimate the database size for the next year(s) 12 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017
  • 15. ▪ The files shouldn’t grow automatically ▪ Keep autogrowth enabled for safety reasons ▪ 256MB autogrowth for data and 1GB for log ▪ Keep an eye on VLFs ▪ DBCC LOGINFO ▪ Don’t mess-up with the security ▪ Don’t assign DB_Owner role to users ▪ Build user roles with the right permissions instead ▪ Don’t assign the dbo to a normal user ▪ Assign to sa or to special login SQL Server Best Practices SQL Server Konferenz 2017 14.02.2017 12
  • 16. Maintenance • Don’t forget instance and database maintenance • Backup checksum and compression • Don‘t do plans, script the tasks • Never shrink during maintenance ▪ Don’t forget instance and database maintenance ▪ Daily Backups (Full and perhaps differential) ▪ Transaction log backups (every 5 – 15 minutes) ▪ Integrity checks (daily) ▪ Index reorganize or rebuild (daily) ▪ Update statistics (daily) ▪ Clean up backup and job history (daily) ▪ Cleanup mail items (daily) ▪ Backup checksum and compression ▪ Enable Compress Backups by default ▪ Saves I/O and disk space ▪ Faster backups ▪ A bit more CPU usage during backup ▪ No reason to not turn it on ▪ Checksum default ▪ No GUI, not documented, but ok to use ▪ EXEC sp_configure ‘backup checksum default’, 1; GO RECONFIGURE WITH OVERRIDE; GO ▪ No reason to not turn it on ▪ Don‘t do plans, script the tasks ▪ Don’t use maintenance plans ▪ Scripts are… ▪ …better reuseable ▪ …more flexible ▪ …more intelligent ▪ Use maintenance scripts 13 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017
  • 17. ▪ Ola Hallengren (https://ola.hallengren.com/) ▪ or from other vendors ▪ or build your own ▪ Never shrink during maintenance ▪ Same problems as AUTO_SHRINK SQL Server Best Practices SQL Server Konferenz 2017 14.02.2017 13
  • 18. Questions & answers… 14 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017
  • 19. 15 14.02.2017 SQL Server Best Practices SQL Server Konferenz 2017