It's T-SQL Tuesday time again, and this month the host is Raul Gonzalez (blog/@SQLDoubleG). His chosen topic is Lessons Learned the Hard Way. (Everybody should have a story on this one, right?)
When considering this topic the thing that spoke most to me was a broad generalization (and no, it isn't #ItDepends)
Yes I am old enough (Full Disclosure) to know many people associate the phrase "Trust But Verify" with a certain Republican President of the United States, but it really is an important part of what we do as DBA's.
When a peer sends you code to review, do you just trust it's OK?
When a client says they're backing up their databases, do you trust them?
When *SQL SERVER ITSELF* says it's backing up your databases, do you trust it?
(Catching a theme yet?)
At the end of the day, as the DBA we are the Default Blame Acceptors, which means whatever happens, we are Guilty Until Proven Innocent - and even then we're guilty half the time.
This isn't about paranoia, it's about being thorough and doing your job - making sure the systems stay up and the customers stay happy.
- Verify your backup jobs are running, and then run test restores to make sure the backup files are good.
- Verify your SQL Server services are running (when they're supposed to be)
- Verify your databases are online (again, when they're supposed to be)
- Verify your logins and users have the appropriate security access (#SysadminIsNotAnAppropriateDefault)
- Read through your code and that of your peers - don't just trust the syntax checker!
- When you find code online in a blog or a Microsoft forum, read through it and check it - don't just blindly execute it because it was written by a Microsoft employee or an MVP - they're all human too! (This almost bit me once on an old forum post where thankfully I did read through the code before I pushed Execute - the post was two years old with hundreds of reads so it would be fine, right? There was a pretty simple mistake in the WHERE clause and none of the hundreds of readers had seen it or been polite enough to point it out to the author!)
- Run periodic checks to make sure all of your Perfmon traces (you are running Perfmon traces, right?), Windows Tasks, SQL Agent Jobs, XEvents sessions, etc. are installed properly and configured with the current settings - just because the instance has a job named "Online Status Check" on it doesn't mean the version is anything like your current code!
...and so many, many, many more.
My belief has always been that people are generally good - contrary to popular belief among some of my peers, developers/managers/QA staff/etc. are not inherently bad people - but they are people. Sometimes they make mistakes (we all do). Sometimes, they don't have a full grasp of our DBA-speak (just like I don't understand a lot of Developer-Speak - I definitely don't speak C#) - and that makes it our responsibility to make sure things are covered as a DBA - we are the subject matter expert in this area, so we need to make sure it's covered.
As I said above, this isn't about paranoia - you do need to entrust other team members with shared responsibilities and division of labor, because as Yoda says:
...but when the buck stops with you (as it so often does) and it is within your power to check something - do it!
Hope this helps!