Live classes start in 1d 07h 56m — Save your seat

SQL Agent, Alerts, and Operational Automation

SQL Agent, Database Mail, jobs, alerts, and operational automation.

16 associated posts16 primary posts

We’re Starting to Automate Testing for the First Responder Kit.

Brent says: It's really funny how the world works. I wrote what you see below in December 2023 and scheduled it for publication on January 16th (today), hoping to get help from the community to get this process started. On January 9, before the post went live, David Wiseman submitted a pull request with the first steps! More on that at the end of the post. I'm leaving the post as-written in Dec 2023 because it's still useful.

Read more about We’re Starting to Automate Testing for the First Responder Kit. 7 comments — Join the discussion

Get Alerted When Your SQL Server Restarts with sp_SendStartupEmail

When your SQL Server restarts, how do you find out?

I've seen a few senior DBAs do a really smart trick: they write a stored procedure to send them an email, and then they mark that stored procedure as a startup stored procedure so that it runs automatically whenever SQL Server starts up. (You could also try this with an Agent job scheduled to run at Agent startup, but ... Agent may not actually start.)

Read more about Get Alerted When Your SQL Server Restarts with sp_SendStartupEmail 25 comments — Join the discussion

Ola Hallengren’s Scripts Keep Getting Better

You Know Him, You Love Him
You trust your database backups and integrity checks to him, and he has been KILLING IT on new features lately.

A while back, Ola decided to Open Source his scripts on GitHub (Soon to be known as Microsoft LiveHub for Business Essentials). As more and more people embrace GitHub and are getting used to how it works, the feature suggestions have been rolling in.

Read more about Ola Hallengren’s Scripts Keep Getting Better 6 comments — Join the discussion
Production DBA

Chaining Agent Tasks For Alerting The Right Way

Step By Step

When you think about setting up maintenance, a persistent fear is that tasks may step on each other. You probably don't want backups and CHECKDB and statistics maintenance running at the same time as statistics maintenance (notice I didn't say index maintenance, here, because you're smart and you skip it?). You may also throw in some other steps, like cleanup tasks something.

Read more about Chaining Agent Tasks For Alerting The Right Way 18 comments — Join the discussion

Simulating Workload With ostress And Agent Jobs

This question comes up a lot
Especially during Office Hours, and the answer is usually... not great. You can spend a lot of money on people and complicated software to design, run, and monitor workloads against test environments, or you can throw together tests with some free tools like SQL Query Stress or Microsoft's RML Utilities.

Read more about Simulating Workload With ostress And Agent Jobs 3 comments — Join the discussion
News & Opinion

Bad Idea Jeans Week: Building a Fork Bomb in SQL Server

Somewhat different than a sex bomb, a fork bomb is a denial-of-service attack that just starts a process that replicates itself, thereby starting more and more processes until the service goes down. Wikipedia's fork bomb page lists examples on most operating systems (including Windows).

I've always found fork bombs funny because of their elegant simplicity, so I figured, why not build one in SQL Server?

Read more about Bad Idea Jeans Week: Building a Fork Bomb in SQL Server 14 comments — Join the discussion

SQL Server Tasks You Probably Shouldn’t Automate

Every now and then I run across an automated script that does something a little suspicious. I'm not saying you should never put these things into a script, but if you do, seriously think about the surprise gotchas when someone runs the script:

DBCC commands other than CHECKDB
sp_configure (and especially RECONFIGURE afterwards)
ALTER SERVER CONFIGURATION
ALTER DATABASE
ALTER AVAILABILITY GROUP
CREATE INDEX or DROP INDEX
KILL
SHUTDOWN
And most of the database engine management stored procedures

Read more about SQL Server Tasks You Probably Shouldn’t Automate 24 comments — Join the discussion
Production DBA

Maintenance Plans and Roombas Suck – in a Good Way

Every now and then, I hear an experienced DBA say, "SQL Server maintenance plans for backups, indexes, and statistics?  What, are you kidding me?  Nobody uses maintenance plans because they suck."

They say maintenance plans are so inflexible because they insist on defragging or rebuilding every index, every time, regardless of how little the table has changed.  Or maybe they complain about problems with scheduling, or how they saw somebody use a DBCC SHRINKDB maintenance plan once.

Read more about Maintenance Plans and Roombas Suck – in a Good Way 30 comments — Join the discussion