DBA's have to write a lot of scripts to perform a wide range of functions, from maintenance to monitoring we have to dig deep into various areas of SQL to get the information that we need to do our job. But I don't like re-inventing the wheel and thankfully for us some of the best scripts are already there! Created by leading experts the following scripts are those that I (and many others) use all of the time and consider to be an essential part of our DBA toolkit.
Ola Hallengrens Maintenance Solution is a comprehensive set of scripts for running backups, consistency checks and index maintenance. The award winning solution is ridiculously easy to set up and contains a huge amount configurable options. Needless to say its used by many organisations around the world.
Next up we have sp_whoisactive written by Adam Machanic which is one of the most used scripts in the universe. The script gives you an incredible amount of information about what is happening within your SQL instance. I have lost count the number of times the script has helped me diagnose problems and like everything one this page is used by database professionals the world over.
Brent Ozar's collection of scripts provide you with some serious troubleshooting capabilities and Sp_blitz is one of my personal favourites. Let this script run and it will return with a wealth of information about your SQL instance, why it is configured correctly and how to rectify it.
Analysing cumulative wait statistics is a fundamental part of troubleshooting and this script by Paul Randal is the one I (and many others) use the most. Just to mention the script originally came from Glenn Berry and was modified by Paul quite a bit.
For me all of these go beyond scripts, they're actually solutions in their own right. Maintenance tasks, monitoring, checking configurations and performance are all covered. Maybe you know of some more, created your own perhaps - let me know!