Top Banner
TOP 10 ADMIN MISTAKES ON SQL SERVER Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: http://KevinEKline.com , http://ForITPros.com
22

Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

Dec 16, 2015

Download

Documents

Lucas Norris
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

TOP 10 ADMIN MISTAKES ON SQL

SERVER

Kevin Kline• Director of Engineering Services, SQL Sentry• SQL Server MVP since 2003• Twitter, FB, LI: KEKline• Blog: http://KevinEKline.com, http://ForITPros.com

Page 2: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

AGENDA

• About SQL Sentry• The Top 10 Countdown: DBA Mistakes on

Microsoft SQL Servero Mistakes come in surprising formso Often people & process, instead of technology

• Summary, Resources, and Q&A

Page 3: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

FOR FRIENDS OF SQL SENTRY• Free Plan Explorer download:

http://www.sqlsentry.net/plan-explorer/

• Free query tuning consultations: http://answers.sqlperformance.com.

• Free new ebook (regularly $10) to attendees. Send request to [email protected].

• SQL Server educational videos, scripts, and slides: http://SQLSentry.TV

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

• Monthly eNews tips and tricks: http://www.sqlsentry.net/newsletter-archive.asp

Page 4: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

TOOLS FROM SQL SENTRY

Page 5: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

OTHER TOP SQL SERVER MISTAKES

Excludes SQL Server mistakes that are primarily development or design in nature:

o Inadequate normalization and database design

o Unknown scalability requirementso No baselines or benchmarkso Indexing issueso Query tuning ignorance

Page 6: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

10. DISKS – THINKING SPACE BUT NOT IO

• Frequently think about disk subsystems only in terms of disk space, not IO load.

• Without this knowledge, the following problems occur:o Inadequate fault toleranceo Insufficient IO:

• OLTP requires high transactions/sec• OLAP requires high MB transfers/sec

o Poor choice of RAID type, controllers, channelso Not enough disk spindles

• SSD is a game changer for IO!

Page 7: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

9. BUSINESS IGNORANCE

• As the IT professional, you should know how SQL Server works at an “internals” level. o What is checkpoint? Lazywriter?o How is TempDB used? What’s in the plan cache?

• The DBA is the guardian of the corporate data assets.• As the liaison between business and IT, you should know

how and in what ways your servers are used. o Who cares if this app is down? How much does the downtime cost the company?o What are the business cycles?o When are the best downtimes?o Baseline? Benchmarks? What is normal?

For more tech info:- SQLPASS.org- SQL University- SQL Crunch- SQLBlog.com

Page 8: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

BONUS BLUNDER: NOT ASKING…

• …for help:• Forums vs Support: know the value• #sqlhelp and Twitter

• …for mentoring:• Senior bloggers love to mentor!

Page 9: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

8. NO TROUBLESHOOTING METHODOLOGY

• When the chips are down, the DBA needs a strong, step-by-step methodology for root-cause analysis. Without one, you get:o Missed errors and problemso Errors resulting data loss and catastrophic failureo Poor response times and breached SLAso Lost credibility

• Don’t have a methodology? Check out End-to-End Troubleshooting on http://SQLSentry.TV

• SQL Server Troubleshooting Guide by J. Kehayias on http://www.simple-talk.com

Page 10: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

BONUS BLUNDER: REACTIVE NOT PROACTIVE

• DEMO

Page 11: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

DEMO: ERROR NOTIFICATIONS

Page 12: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

7. GOING WITH THE DEFAULTS

• SQL Server installation defaults are intended to get the server up and running, but not running optimally:o Auto-grow and Auto-shrink on databaseseo Auto sizing of auto-growing databaseso Default filegroupso Minor issues can become major issues:

• MAXDOP• FILLFACTOR

o Many server- and database-level configuration settings

Page 13: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

6. SECURITY AS AN AFTERTHOUGHT

• SQL Injection is the #1 hack on the internet today.o Remarkably, we knew as much about preventing SQL Injection ten years

ago as we do today.

• Plan ahead of time to minimize issues:o Ensure the least privileges principle for applications running on your serverso How much surface area do your servers expose?o Who has access to your servers?o How do you find out the who, what, and when of a breach?

• See my session Understanding & Preventing

SQL Injection for more info

Page 14: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

5. INADEQUATE AUTOMATION

• Automation is the means by which DBAs work “smarter” instead of “harder”. Ironically, it takes a lot of work at the outset to automate.

• Without automation, DBAs must deal with: o Manual processes prone to error, omission, and forgetfulnesso Inability to scale environment to multiple serverso Time constraints from fire-fighter and script-pusher modes

• Examples of working smarter instead of harder:o Automated error notificationo Scheduled jobso Lots of scripts, not too much GUI

Automation made easy with PowerShell and/or WMI:- PowerGUI- Scriptomatic

Page 15: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

4. WRONG FEATURE OR TECHNIQUE FOR THE JOB

• DBA’s are the “performance engineer” for their corporation’s IT applications.

• It’s imperative that the most appropriate feature be applied to each business requirement. Otherwise: o Brittle applicationso Applications complexity o Excess resource consumptiono “Ooooh! Shiny!”o Design reflects the current “fad”

• Axiom: There are no IT projects. There are business projects solved using IT.

Page 16: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

3. APATHY ABOUT CHANGE MANAGEMENT

• Change management is important! Without it, DBAs face:o Changes that leave things worse than they startedo Piecemeal rollbacks that cripple applicationso Inconsistent support across applications and servers

• Change control versus Change management?• Proper change management means:

o Key stakeholders have a say in Go-NoGo (CM board)o Performed at pre-planned times and within a defined time limito Change is tested and verified to have no effect or positive effect on production

environmento Changes are isolated, atomic, and reversible

Page 17: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

2. INADEQUATE PREVENTATIVE MAINTENANCE

• Proper preventative maintenance (PM) helps you: o Catch issue before they become problemso Ensure optimal performanceo Perform resource intensive operations with few, if any, users on the system

• PM on SQL Server should include:o Database consistency checks (DBCC) and CHECKIDENTo Backups with verification & Restore checkso Defragmentation, Fill factor, Pad Indexo Index Statistics

• Don’t rely on the Database Maintenance Wizard!

Page 18: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

BONUS BLUNDER: REINVENTING THE WHEEL

• Most PM has already been written and vetted by others.

• Check out: o www.sqlfool.com o www.olahallengren.com

Page 19: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

1. BACKUPS <> RECOVERYDBAs often don’t test backups or recoveries as they should. Causes lots of problems:

o Can you meet your SLA? RTO? RPO?o Not certain that backups are good: verified and available?o Where’s all the data, files, DLLs, etc for recovery?o Got all of the databases that are needed?o Haven’t tested a full, ground-up restore:

• What if you have to reinstall everything?o One of the great things about VM recovery!

• The importance of recovery: the Lost Job scenarioo Can you actually restore older, archived data?

It’s All About

The Data, AllThe Time, Every

Time

Page 20: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

SUMMARY

1. Only a few big DBA blunders are due

to tech skills: Disks as space, not IO No troubleshooting methodology

Going with the defaults2. Most DBA blunders are due to process

and business issues: Security as an afterthought Wrong features Change management

Preventative maintenance/automation

Backups <> Recovery

Page 21: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

RESOURCES• http://www.sqlcat.com - Excellent source of SQL

Server best practices, white papers, etc.• Paul Randal and all the blogs at SQLSkills –

http://www.sqlskills.com/blogs/paul/ et al• http://SQLPerformance.com • http://www.sqlpass.org

Page 22: Kevin Kline Director of Engineering Services, SQL Sentry SQL Server MVP since 2003 Twitter, FB, LI: KEKline Blog: , ://KevinEKline.com.

Q & A

• Send questions to me at: [email protected] • Twitter, Facebook, LinkedIn at KEKline• Slides at http://SQLSentry.TV • Kevin’s IT leadership and soft-skills content at

http://ForITPros.com

THANK YOU!