Tag Archives: Tangent

Do good DBAs use scripts…?

So recently I received a funny look when I was asked a couple questions.  The questions were along the lines of “How do you….” and my answers were along the lines of “I have a script that does…” each time I answered that I have a script and then went on to explain what the script does, the reaction was somewhat surprising.  “You have scripts…” he scoffed.

Naturally this made me question the world I live in.  Should I be able to memorize every single DMO to always be able to get the information I need?  Should I be so quick at typing that re-writing somewhat lengthy TSQL queries is no big deal?  Should I make a back up plan for that one day google, dropbox, and the usb stick I carry will all be out of commission?  What’s wrong with using scripts?

I can see a good reason to be familiar with as many DMOs as possible, and I can see very good reasons to be intimate with others.  For example, in my most recent studies of indexing I would recommend you get very intimate with; sys.dm_db_index_usage_stats, sys.dm_db_index_operational_stats, sys.dm_db_index_usage, and sys.dm_db_index_physical_stats (I will be posting about each of these DMOs for personal enjoyment).  Now, should you memorize each and every column…well perhaps?  I mean the more you use the information, the more that you actually apply the information in your DBA duties, you will eventually end up memorizing what you need.  So, for the short answer, yes you should know quite a few DMOs, but you really should write and keep scripts that pull the information you need from them quickly.

To be completely honest, I’d be a little weary of a DBA that didn’t have a collection of scripts that has been adapted to their style.  I would definitely ask them if they had been living under a rock, or just not doing much at their current job (or I would ask them what it’s like to be a super genius and why they chose to live on this planet).

Personally, I keep a folder on dropbox and I keep a RedGate USB Stick, (schwag I received for submitting a SQL Monitor custom alert), full of scripts.  I have them organized very nice and neatly, and I know what they do and when I need them.  These are all scripts I have acquired over the years, through google, through books, and through interactions with other DBAs.  I use these scripts so frequently that I even create SSRS reports for many of them, and have them sent to my inbox for coffee reports.

So I pose the question to all of you.  Do good DBAs use scripts?