22
BUILDING & CONFIGURING SQL SERVER Recommended Practices

Building and configuring sql server; Some Recommended Practices

Embed Size (px)

Citation preview

Page 1: Building and configuring sql server; Some Recommended Practices

BUILDING & CONFIGURING SQL SERVER

Recommended Practices

Page 2: Building and configuring sql server; Some Recommended Practices

Tuning blog: http://www.sqlperformance.com/

E-mail [email protected] for free copies of our $10 e-books:

Page 3: Building and configuring sql server; Some Recommended Practices

Book a Demo with me by going to http://www.meetme.so/JohnQMartin

Page 4: Building and configuring sql server; Some Recommended Practices

YOUR PRESENTER• John Q Martin

o Sales Engineer for SQL Sentryo Worked with SQL Server for ~10 yearso Consultant, SQL DBA, Dev & BI Developero Former Microsoft Premier Field Engineer

• Contact Informationo Email: [email protected] Blog: http://blogs.sqlsentry.com/author/JohnMartin/ o Twitter: @SQLDiplomato LinkedIn: https://uk.linkedin.com/in/johnqmartin

Page 5: Building and configuring sql server; Some Recommended Practices

PLANNING

Before deploying SQL Server it is important to have a plan

Capacity Planning

What is the use case

Versions and Editions

Virtual or Physical

Cloud or On-Premises

HADR

Page 6: Building and configuring sql server; Some Recommended Practices

CAPACITY PLANNING

Storage

Memory

Analyse History

Project Use

Scalability

Page 7: Building and configuring sql server; Some Recommended Practices

PRE-DEPLOYMENT

Infrastructure Configuration• Drivers & Firmware• Correct multi-pathing configuration• Storage setup

Testing & Validation• Soak Testing• Stress Testing

Page 8: Building and configuring sql server; Some Recommended Practices

DEPLOYMENT

Standardise• Small number of versions• Operating System

Automate• Sysprep & Configuration Files• SPADE framework

Page 9: Building and configuring sql server; Some Recommended Practices

SERVICE ACCOUNTS

Compartmentalise• Use different accounts for each service

Domain accounts where possible• Manage Service Accounts (MSA)• Group Managed Service Accounts (gMSA)

Page 10: Building and configuring sql server; Some Recommended Practices

SQL SERVER CONFIGURATION

Trace Flags•1117 – Data File Growth•1118 – Dedicated Extents•3226 – Backup Messages

Page 11: Building and configuring sql server; Some Recommended Practices

SQL SERVER CONFIGURATION

sp_configureBackup checksum default

Backup compression default

Max degree of parallelism

Page 12: Building and configuring sql server; Some Recommended Practices

NUMA Node 1NUMA Node 0

NUMA FROM 30,000 FT

CPU 0 CPU 2

CPU 1 CPU 3

RAM 01

RAM 02

RAM 03

RAM 04

Thread 0

Thread 1

Thread 0

Thread 1

Thread 0

Thread 1

Thread 0

Thread 1

Processor Socket 0

CPU 0 CPU 2

CPU 1 CPU 3

RAM 01

RAM 02

RAM 03

RAM 04

Thread 0

Thread 1

Thread 0

Thread 1

Thread 0

Thread 1

Thread 0

Thread 1

Processor Socket 1

Typical MAXDOP setting for this configuration would be 4

Page 13: Building and configuring sql server; Some Recommended Practices

SQL SERVER CONFIGURATION

sp_configureBackup checksum default

Backup compression default

Max degree of parallelism

Min/Max Server Memory

Optimize for ad hoc workloads

Remote admin connections

Page 14: Building and configuring sql server; Some Recommended Practices

XP_CMDSHELL

It Depends!

Page 15: Building and configuring sql server; Some Recommended Practices

SQL SERVER CONFIGURATION

Security•Avoid using SQL Authentication•Disable and Rename SA•Proxies for Agent Jobs•Perform Volume Maintenance Tasks

Page 16: Building and configuring sql server; Some Recommended Practices

LOCK PAGES IN MEMORY

Tier 1 Systems• On• Cannot afford downtime/impact

Tier 2 systems• Off• Identify issue & RCA

Page 17: Building and configuring sql server; Some Recommended Practices

TEMPDB

Multiple Files

Dedicated storage

Separate data and log files

Page 18: Building and configuring sql server; Some Recommended Practices

DATABASE CONFIGURATION

Instant File Initialization

Multiple files

Separate Data and Log

Checksum page verification

Appropriate Database Owner

Page 19: Building and configuring sql server; Some Recommended Practices

MAINTENANCE OPERATIONS

DBCC CHECKDB

Backups

Re-indexing & Statistics Maintenance

Log Rotation

Monitor dbo.suspect_pages in MSDB

Page 20: Building and configuring sql server; Some Recommended Practices

MONITORING & ALERTING

Monitor key performance counters

Generate baselines

Configure SQL Agent Alerts

Policy Based Management

Page 21: Building and configuring sql server; Some Recommended Practices

QUESTIONS

Page 22: Building and configuring sql server; Some Recommended Practices

THANK YOU!

• Slides will be available at http://blogs.sqlsentry.com/author/johnmartin

• E-mail [email protected] for free copies of our e-books:o Just tell them where you met me

• My contact info for other questions:o Email: [email protected] o Twitter: @SQLDiplomat