Download presentation
Presentation is loading. Please wait.
1
SQL Server Management Strategies
2
Please Support Our Sponsors
SQL Saturday is made possible with the generous support of these sponsors. You can support them by opting-in and visiting them in the sponsor area.
3
Don’t forget to silence your phone
4
Post Con
5
whoami Senior DBA @ Alberta Gaming & Liquor Commission 10+ Years in IT
Moved to Edmonton April 2016 10+ Years in IT Originally from Kamloops BC Graduated from Thompson Rivers University 9 years working in Vancouver BC
6
Agenda SQL Server Best Practices Technologies Building your servers
Application Deployment Maintenance & Operations
7
SQL Server Best Practices
8
Windows Configuration
Local Security Settings Lock Pages In Memory Perform Volume Maintenance Tasks Logon as a service
9
Windows Configuration
Power Settings High Performance Mode Windows Firewall Disable Create Rule for SQL Server Ports
10
Disk Setup Separate Disk Drives Formatting Data Log TempDB System DB
Backups Formatting NTFS 64KB Block Size ReFS
11
Instance Configuration
Max Degree of Parallelism (MaxDOP) Default is 0 Set to 8 or number of physical cores for your processors Cost Threshold for parallelism Default is 5 Consider raising – 50 is a good starting point Optimize for Adhoc Workloads Optimizes Plan Cache
12
Instance Configuration
Min/Max Memory Default Minimum is 0 MB Default Maximum is MB Set the min if reservation is needed Multiple Instances Max Memory Leave room for OS/Other programs onathan/how-much-memory-does- my-sql-server-actually-need/
13
Instance Configuration
TempDB Configuration Add files for multiple cores Change Auto Growth Model Database Set Recovery Model
14
Instance Configuration
CPU Affinity Mask Consider setting if you have multi- instance servers Trace Flags 1117, 1118, 3226, 7806 SysAdmins
15
Database Maintenance Common Tasks Tools Backups Integrity Check
Index's/Statistics History Cleanup Cycle Error Log Tools Built In Maintenance Plans Roll your own scripts Ola Hallengren's Scripts 3rd party tools
16
Database Maintenance Daily Maintenance Sub Hourly Weekly
Full Backups (User Databases) DBCC CheckDB (User Databases) Index Maintenance (Defrag) Statistic Updates Sub Hourly Log Backups Weekly Full Backups (System Databases) Integrity Check (System Databases) System Log Rollover MSDB History Cleanup Index Maintenance (Rebuild)
17
SQL Server Best Practices
Define what your best practices are Makes these your standard The internet is full of advice Do your own research Determine what makes sense for you Not all of your instances will follow every standard Eg: SharePoint But better off having a proper starting point
18
Technologies
19
Policy Based Management
Introduced in SQL Server 2008 Consists of 3 components Facets – A set of logical properties Conditions – A Boolean expression that evaluates a target using a facet. Policy – The expected behavior of a condition. When policies are evaluated Failed policies can generate alerts Can prevent configuration changes
20
Group Policy Uses Active Directory to push configuration
Computer or User Settings Applied to computers joined to AD domain Can be used to Install Software Update Registry Settings User Rights Computer Settings
21
Desired State Configuration
PowerShell feature Introduced in version 4 Introduces configuration function Utilize DSC Modules State based configuration Script can be run multiple times without a problem Configuration data passed into configuration function
22
Building Your Servers
23
Building Your Servers Provision Server Configure OS Install SQL Server
Configure SQL Server
24
Building Your Servers Build a framework that works for you
That makes your life easier Makes standards easier to implement Ensures that others can follow New instances shouldn’t add overhead Design processes/framework to scale New instances shouldn’t add a lot of overhead Works towards a DevOps workflow
25
OS Configuration Utilize AD infrastructure
Push OS configuration with Group Policy Separate OU for SQL Server Group Policy applied to that OU Virtualization Utilize a standard template Ensures disk structure is consistent Server build can become automated
26
SQL Installation Command Line Install Install from configuration file
Local installation option Define install parameters in command line Install from configuration file Define parameters in config file Desired State Configuration (PowerShell) Remote installation option Define parameters in configuration function
27
Desired State Configuration
Numerous modules by Microsoft on GitHub xSQLServer Install and Configure SQL Server xDatabase Deploy databases xFailoverClustering Setup Windows Server Failover Clustering Other modules available Mike Fal’s cSQLResources
28
SQL Configuration First Time Configuration Maintaining Configuration
Desired State Configuration Scripts Maintaining Configuration Policy Based Management Jobs Triggers
29
Application Deployment
30
Application Deployment
Define Be as granular as it makes sense for you Standards should be easy to enforce If you spend all your time enforcing its time to revisit Determine who is going to implement these standards Developer or DBA? Standards for application deployment Build against these standards
31
Users Windows authentication is preferred
Define a AD group structure that works for you Eg: app_users, app_read, app_admin
32
Database Standards Define your logical and physical structures Example
Filegroups, schemas, naming conventions Example Application components use different schemas Each schema resides in a different filegroup Separate file groups for data and indexes File groups named after schema Eg: <Schema>_Data, <Schema>_Indexes Files named <DBName>_<FileGroup>.ndf
33
Database Deployments Migration Based Deployments
Change scripts in order executed to upgrade database versions Use PowerShell/SQLCMD to execute scripts in order Each change has change scripts associated State Based Deployments Changes deployed based on comparison Compare with staging database Compare with deployment file (DACPAC) Demo
34
Client Connectivity Decouple client application from server name
SQL Server Alias (Client Configuration) DNS CName (DNS Server) Availability Group Listener Easy client redirection No changes to client configuration if server name changes
35
Maintenance & Operations
36
Maintenance Plans Treat like an application Should be flexible Demo
Package scripts/jobs and deploy Push the same solution to all instances Schedules may vary Should be flexible Ola Hallengren Demo
37
Daily Checks Automate Alert on fails Log everything
Scripted Checks Policy Based Management Alert on fails Spend your time focusing on the problems Log everything Failure to log is a failed check Treat your instances as a pool Don’t focus on individual instances
38
Monitoring & Alerts Monitoring Software SQL Agent Alerts
SQL Server specific product are expensive Licensed per instance Generic Monitoring Software such as SCOM Can be lacking in what you need SQL Agent Alerts Event Notifications Service Broker Extended Events
39
Automation Identify what tasks take up your time
Improve the process until it can be automated Once automated you can free up your time Ideally you can offload the task all together Setup a Central Management Server Allows you to run a query against multiple Instances
40
Closing Thoughts Scripting/Programming is key
The specific tool doesn’t matter its how its used Understand how to leverage infrastructure Know what is available to you and how to leverage it Continuous Learning Find ways to apply what you learn Identify what works for you Automate the easy tasks Define and enforce your standards Free your time for new and exciting work
41
Questions?
42
References https://ola.hallengren.com/
Ola Hallengren Lock Pages In Memory server-and-the-lock-pages-in-memory-right-in-windows-server/ Instant File Initialization and-why-to-enable-instant-file-initialization/ Power Options performance-on-windows-server-when-using-the-balanced-power- plan
43
References State vs Migration-Driven Database Delivery
Data-tier Applications applications Data-tier deployments a-data-tier-application
44
References DSC Modules Mike Fal’s Blog xSQLServer xDatabase
xDatabase xFailoverCluster Mike Fal’s Blog
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.