How Not to be a Cranky DBA
     Tips for Bringing Sanity to Your SQL Server Environment
Mike Hillwig
 AKA The Cranky DBA

 SQL Server DBA

 Working with SQL Server since SQL 7

 Contract DBA at hosting division of a financial software
  company

 Working as the lone SQL DBA in an army of Oracle DBAs

 Resume includes Acme Packet, Shawmut Design and
  Construction, Equitable Resources
Mike Hillwig
 Avid Cook

 Lover of Blue Cheese

 And Bacon

 Geek at Heart

 Owned by Two Pugs
Obligatory Social Networking Slide
 crankydba.com

 sqlserverpedia.com

 twitter.com/mikehillwig
 SQL Saturday Waltham – 5/19/2012

 SQL Saturday Providence – 9/15/12

 SQL Saturday Nashua – 10/20/12

 Call for speakers in Providence and
  Nashua still open
No Need for Notes
Blog post and slide deck will be available later tonight
Tonight’s Format
What Makes a DBA Cranky
 Fixing Unnecessary Mistakes

 Lack of Sleep

 Answering Redundant Questions

 Repeating Manual Processes

 Performance Problems

 Waiting

 Unnecessary Emergencies
Why Does This Make Us Cranky?
We Would Rather
 Spend time with our
  families

 Read

 Sleep

 Play Angry Birds

 Eat Bacon

 Anything other than work
The Tips
Beware of the Blogs

 There is some amazing
  advice out there. But…

 Anybody can put bad advice
  on the internet

 Trust people you know

 I don’t trust people who say
  “ALWAYS” or “NEVER”

 Test everything in your own
  test environment first.
Don’t enable Auto Shrink. Ever.
 This is my only exception
  to “NEVER” advice

 You can’t control when it
  runs

 What you shrink will just
  grow again

 Fragments your indexes

 Instead: Use DBCC
  Shrinkfile
Triggers don’t’ send mail
 Does it need to be now, now, right this very
  moment, now?

 Connecting to an outside application is costly for
  performance

 If the mail server is down, users get ugly results.

 What happens if mail XPs get disabled?

 Instead, write to a queue table and have a SQL Agent
  job process the queue.
Developers Don’t Touch Production

 Developers like to “fix”
  problems.

 Changes must be tested
  before moving into
  production.

 Every environment needs
  a gatekeeper/traffic cop

 You ARE using source
  control, right?
Ask questions like an auditor
 “What would Sandra say?”

 What is our risk exposure?

 Are there any security concerns?

 Will this pose any compliance problems?

 Does this touch anything financial?

 Don’t be afraid to ask your auditor
Consistency is Key
 Versions                 Easier to Troubleshoot

 Configurations           Easier to Remember What’s
                            Where
 Maintenance Processes
                           Leverage the SQL Agent
                            MSX Server
Master the SQL Agent
 Easily automate manual tasks

 Run scripts regularly and have them alert you to
  conditions

 Severity alerts are your friend

 Use Multi-Server Administration
Use Instant File Initialization
 Prevents waiting for a file to grow

 Makes RESTOREs run faster

 Creating new databases is much faster
Plan for when things go bump in the
night

 And they do go bump in the night

 Have a regular troubleshooting script for databases and
  applications for your first-level support

 Give common errors and how to resolve them

 Tailor your alerts to indicate which items require
  immediate attention and which should be flagged for
  next-day resolution
Set Min and Max RAM
 Extremely important in virtual environments

 MIN allows you to be greedy

 MAX gives the OS breathing room
Your server is not a workstation
 Avoid Remote
  Desktop
 Don’t run SSMS
  directly from your
  server
 Instead: Run from
  a workstation
 RUNAS is your
  friend
Set your file growth increments
 Defy the defaults!
 Growth is an ALTER, which is a database lock, which is a
  performance issue
 More growths = fragmentation
 Log growths = high VLFs
 Better yet, monitor regularly and grow files manually
Test restores. Frequently.
 Easily automated

 The worst time to test a restore is when your production
  server fails

 It’s good practice for when something does fail

 Don’t forget to test recovering from long-term storage

 Test recovering to a specific point in time as well as key
  business processes
Reserved words are just
that, reserved

 Reserved words as column names make writing queries
  harder

 [avoid this]

 If it turns blue in SSMS, try something else

 Common offenses:
   SECURITY
   STATUS
   IDENTITY
Limit access to SA and service
account passwords

 Not everyone needs to connect as SA

 Why? Why? Why must anyone have it?

 More hands = less control

 Does the application really need to connect as SA?

 Don’t be afraid to fight with the vendor

 Avoid Mixed Authentication Mode where possible

 Embrace AD authentication
Database servers are that and that
alone.

 Databases are the foundation of most critical business
  applications

 If the database server is slow, everything else is slow

 Web servers, SSRS, SSAS, and SSIS go on a different box

 Keeps server optimized for running databases

 It’s okay to be greedy with system resources
Questions
More
Blog Post at crankydba.com/go/nesql

How not to be a cranky dba

  • 1.
    How Not tobe a Cranky DBA Tips for Bringing Sanity to Your SQL Server Environment
  • 2.
    Mike Hillwig  AKAThe Cranky DBA  SQL Server DBA  Working with SQL Server since SQL 7  Contract DBA at hosting division of a financial software company  Working as the lone SQL DBA in an army of Oracle DBAs  Resume includes Acme Packet, Shawmut Design and Construction, Equitable Resources
  • 3.
    Mike Hillwig  AvidCook  Lover of Blue Cheese  And Bacon  Geek at Heart  Owned by Two Pugs
  • 4.
    Obligatory Social NetworkingSlide  crankydba.com  sqlserverpedia.com  twitter.com/mikehillwig
  • 5.
     SQL SaturdayWaltham – 5/19/2012  SQL Saturday Providence – 9/15/12  SQL Saturday Nashua – 10/20/12  Call for speakers in Providence and Nashua still open
  • 7.
    No Need forNotes Blog post and slide deck will be available later tonight
  • 8.
  • 9.
    What Makes aDBA Cranky  Fixing Unnecessary Mistakes  Lack of Sleep  Answering Redundant Questions  Repeating Manual Processes  Performance Problems  Waiting  Unnecessary Emergencies
  • 10.
    Why Does ThisMake Us Cranky?
  • 11.
    We Would Rather Spend time with our families  Read  Sleep  Play Angry Birds  Eat Bacon  Anything other than work
  • 12.
  • 13.
    Beware of theBlogs  There is some amazing advice out there. But…  Anybody can put bad advice on the internet  Trust people you know  I don’t trust people who say “ALWAYS” or “NEVER”  Test everything in your own test environment first.
  • 14.
    Don’t enable AutoShrink. Ever.  This is my only exception to “NEVER” advice  You can’t control when it runs  What you shrink will just grow again  Fragments your indexes  Instead: Use DBCC Shrinkfile
  • 15.
    Triggers don’t’ sendmail  Does it need to be now, now, right this very moment, now?  Connecting to an outside application is costly for performance  If the mail server is down, users get ugly results.  What happens if mail XPs get disabled?  Instead, write to a queue table and have a SQL Agent job process the queue.
  • 16.
    Developers Don’t TouchProduction  Developers like to “fix” problems.  Changes must be tested before moving into production.  Every environment needs a gatekeeper/traffic cop  You ARE using source control, right?
  • 17.
    Ask questions likean auditor  “What would Sandra say?”  What is our risk exposure?  Are there any security concerns?  Will this pose any compliance problems?  Does this touch anything financial?  Don’t be afraid to ask your auditor
  • 18.
    Consistency is Key Versions  Easier to Troubleshoot  Configurations  Easier to Remember What’s Where  Maintenance Processes  Leverage the SQL Agent MSX Server
  • 19.
    Master the SQLAgent  Easily automate manual tasks  Run scripts regularly and have them alert you to conditions  Severity alerts are your friend  Use Multi-Server Administration
  • 20.
    Use Instant FileInitialization  Prevents waiting for a file to grow  Makes RESTOREs run faster  Creating new databases is much faster
  • 21.
    Plan for whenthings go bump in the night  And they do go bump in the night  Have a regular troubleshooting script for databases and applications for your first-level support  Give common errors and how to resolve them  Tailor your alerts to indicate which items require immediate attention and which should be flagged for next-day resolution
  • 22.
    Set Min andMax RAM  Extremely important in virtual environments  MIN allows you to be greedy  MAX gives the OS breathing room
  • 23.
    Your server isnot a workstation  Avoid Remote Desktop  Don’t run SSMS directly from your server  Instead: Run from a workstation  RUNAS is your friend
  • 24.
    Set your filegrowth increments  Defy the defaults!  Growth is an ALTER, which is a database lock, which is a performance issue  More growths = fragmentation  Log growths = high VLFs  Better yet, monitor regularly and grow files manually
  • 25.
    Test restores. Frequently. Easily automated  The worst time to test a restore is when your production server fails  It’s good practice for when something does fail  Don’t forget to test recovering from long-term storage  Test recovering to a specific point in time as well as key business processes
  • 26.
    Reserved words arejust that, reserved  Reserved words as column names make writing queries harder  [avoid this]  If it turns blue in SSMS, try something else  Common offenses:  SECURITY  STATUS  IDENTITY
  • 27.
    Limit access toSA and service account passwords  Not everyone needs to connect as SA  Why? Why? Why must anyone have it?  More hands = less control  Does the application really need to connect as SA?  Don’t be afraid to fight with the vendor  Avoid Mixed Authentication Mode where possible  Embrace AD authentication
  • 28.
    Database servers arethat and that alone.  Databases are the foundation of most critical business applications  If the database server is slow, everything else is slow  Web servers, SSRS, SSAS, and SSIS go on a different box  Keeps server optimized for running databases  It’s okay to be greedy with system resources
  • 29.
  • 30.
    More Blog Post atcrankydba.com/go/nesql

Editor's Notes

  • #9 Going to tell storiesHave about fifteen slides full of topic. May get to them all. We may not.
  • #10 Ask crowd: What makes you cranky?
  • #14 Good advice out there, but…Lots of outdated information. Do DB servers really need 2x RAM for PF?
  • #15 Story: CRM vendor troubleshooting perf problem. Wouldn’t support us without autoshrink. Says too much space in data files causes problems.When does autoshrink kick in? Tuesdays when your finance people are trying to close the books on the quarter.
  • #16 Story: Elevator contracts
  • #17 This used to be an “ever” slide.