r/SQLServer
•
u/patrickGuyInACube
Microsoft Employee
•
May 13 '26
•
2
Community Request What are you using SQL Server Agent for today?
Yooo! Allow me to re-introduce myself… my name is Patrick.
It’s been a minute since I’ve been deep in the SQL Server world. Back in my DBA days, SQL Server Agent was everywhere:
- backups
- maintenance
- ETL jobs
- alerts
- scheduled scripts
- and honestly… everything else too
So now I’m curious…
What are you using SQL Server Agent for today?
What’s working so well you’d say “don’t touch it”?
What still feels clunky, painful, or way too manual?
Have you moved away from it completely? If so, what changed?
And if Microsoft handed you a magic wand for SQL Server Agent… what’s the first thing you’d fix?
Would love to hear what real-world SQL Server operations actually look like today.
And honestly… thanks in advance for the trip down memory lane.
17
u/SQLDevDBA 3 May 13 '26 edited May 13 '26
Yooooo Patrick! Been a fan since like 2017 man (Adam & Patrick Unplugged). Good to see you here.
For me, I use the Agent for a few things:
Running SSIS packages
Running PS1 (PowerShell) scripts (especially DBATools stuff)
Backups
Maintenance (checkDB, indexes, stats)
Linked server integrity checks (simple queries to detect if there is a LS outage before EOD).
Running Brent Ozar’s sp_blitz to tables every X minutes or hours.
Running Adam Mechanic’s sp_whoisactive to a table to get long running query alerts.
Running SSRS/PBIRS subscriptions.
I also used to use it as an orchestrator to take action on ORACLE instances since I hated the Oracle Jobs/Cron functionality. Thankfully that’s not something I have to worry about anymore.
I think the clunkiness for me:
GUID Named SSRS Subscription Jobs
Schedules that seem to be interloped/intermingled with each other: it takes me time to train new folks to NOT change a job’s schedule if they don’t know if other jobs are using it.
I absolutely LOVE DBATools’s Job History Timeline, I use it a ton and wish MS had something native: https://dbatools.io/timeline/
11
u/itsnotaboutthecell Microsoft Employee May 13 '26
Wait a second...
SQL Server 2012 Step-by-Step Patrick?!
SQLLunch.com Patrick?!
what in the world you been up to all these years? :P
4
u/SQLBek 1 May 13 '26
Yooooo!!!!
4
u/Type-21 May 13 '26
Sending newsletter emails from the database ._.
It's a legacy thing
3
u/PowerbandSpaceCannon May 13 '26
Refreshing power bi datasets using the rest api, after the warehouse has loaded.
3
u/SingingTrainLover May 13 '26
Hello, my friend, it's been a while! (SQLRunr here.) I'm mostly retired, but have a couple of clients still.
To answer your question: maintenance & backups, ETL, gathering server stats, sending reports, mostly.
Take care, Patrick!
3
u/_edwinmsarmiento 1 May 13 '26
Yooo!
The guy wearing an LSU jersey at a SQLSaturday event 🙂
Been a while, my friend.
2
u/sirchandwich 1 May 13 '26
All the above + scheduling unattended promotions.
2
u/RandyClaggett May 13 '26
Backups, Maintenance, keeping track of usage. In some cases scheduled and unscheduled restore jobs. And whatever the AM and BI teams throw at us.
2
u/Hungry_Reference_333 May 13 '26
Use it for….
• backups • maintenance • ETL jobs • alerts • scheduled scripts • and honestly… everything else too
Why not? I have also used ADF in other setups for the same purpose, but when the icing is removed, the basically do the same job. ADF can integrate with some external sources, but since I prefer to do this in TSQL anyway, that is not a feature, rather thing that adds more complexity and makes debugging more difficult.
2
u/blinner 1 May 13 '26
We use it for all kinds of things and it's mostly pretty good.
If I could wave magic wand I would add some features. Here are 2 of them.
1. If a job is running but nothing noteworthy has happened yet, nothing is in job history. If there is a sudden reboot we may have no idea that the job was running when we dropped. A "job started" history row similar to the job completed would be awesome.
2. Sometimes we miss an execution. Either Agent just burlaps and doesn't do it. Or the server reboots at 10pm and my 10pm job never gets to run. I have written jobs to look for missed executions and alert me, but I would love for that process to be less...awful? The code stinks and isn't super reliable. But it has saved me more than once while false alarming me only about a million times.
1
u/TheGenericUser0815 1 May 13 '26
• backups
• maintenance
• ETL jobs
• alerts
• scheduled scripts
• and honestly… everything else too
All of this. But tbh, it still bothers me, that MS decided the account operating the windows service needs to be sa in the instance. Until SQL Server 2014 it wasn't that way. No idea how security would improve by this.
1
u/Better-Credit6701 May 13 '26
So many jobs. Some to create and run reports, most of them have to do with loading data into the database, usually tens of millions of rows per day with the bigger imports manually done. Weekly maintenance and so many more.
1
u/FreedToRoam May 13 '26
Custom backups to a remote drive(not on our network)
cpu usage collection and history
drive space usage collection and history
login usage and creation alerts
index creation and and drop usage
ETLs
Logshipping
Custom reindexing and history tracking
notifications on various business rules and events
dynamic asynchronous job creation and execution for large ETL loads or exports
detection and pushing and pulling of ftp files from DMZ to internal networks and vice versa
custom sharding
1
u/Valuable-Patience-96 May 13 '26
Other than typical maintenance and backups; I mainly use SQL Agent to schedule PoweShell scripts that use the 'dbatools' module. I have SQL Agent Jobs out on our CMS to restore and integrity check recent backups. I also have jobs that dump instance / database properties, maintenance / backup jobs, and logins into an inventory database.
1
u/kill-t May 13 '26
It works reliably, but management of failed (or unrun!) tasks is tedious . I.e., you can't rely on sql agent to communicate errors, because what happens if the task never initiates? Now you need an entire monitoring layer thats looking at the agent history and sending alerts if a job you expected to run hasn't completed.
1
u/Thallerich May 13 '26
Backup and restore (in one single job) to copy a production database as a "playground" testing database for our users.
Index / Statistics Maintenance (ola hallengren's scripts)
query logging for performance / blocking analysis using sp_whoisactive
1
u/Codeman119 May 13 '26
I use it for maintenance,
some data integrity checks,
SSIS jobs syncing our systems
with salesforce
And Survey Monkey
1
u/Strongfatguy May 13 '26
Mostly SSIS scheduling, dev refreshes, and the occasional temporary backup job when application aware backups have an issue. We had some performance and scheduling logic issues years ago that required tuning some nasty queries on a 20TB DW. After a few months of explain planitis that's been rock solid. A few legacy alert jobs are still around. Some old apps use them for archiving or data management.
The only thing I dislike about agent jobs are the permissions models. We generally have AD groups for teams that manage certain jobs. The lack of support for group ownership of jobs, without hacky solutions, leads to groups with sysadmin rights. Jobs also fail when the owner's AD account gets deleted or disabled depending on their access.
1
u/JamesRandell May 13 '26
The more unusual way I’ve used it is as an asynchronous processing engine. I know there is service broker, however sql agent provides a type of poor man’s broker without the complicated set up and management.
Not sure how that helps, but would always like some more holistic ways of logging statuses, and clean up options baked into the agent system. I create this myself as part of my own implementation. I have a rundown of over a dozen or so odd edge case situations where a dynamic job creation gets stuck, usually at the end)
Don’t get me wrong, I know I’m fighting a technology they wasn’t designed for doing that, but it makes life interesting and solved a problem without having to use other technologies (which has the spec in my case).
Right now I’m using it to simulate a multi session sproc refactor test harness tool
Do
1
u/dyogenys May 13 '26
I use it to update datasets. It’s so easy and reliable. I’ve even replaced an already finished and working Kafka streams transformation pipeline with sql batch jobs because it’s much less sketchy. My Kafka mentor who hated databases would turn in his grave if he was dead
3
u/BobDope May 14 '26
Wow remember when that’s what we meant by ‘agents’
2
u/SonOfZork May 14 '26
Make the run information use real datetime values and allow adjusting the concurrent subsystems again.
Bonus points for proper msdb indexing out of the box 😄
2
u/muaddba 1 May 17 '26
I'd fix: The default job history retention. The values were awful 15 years ago and they are even worse as defaults now. It should default to be set to keep a minimum amount of history for each job so that a job running every minute doesn't remove the history for a job that runs once a week.
Add functionality for availability groups: Allow the creation of jobs that run only on primary or only on secondary,etc as built-in features instead of requiring a special job step.
I know this is probably more of an SSMS thing, but better filtering options. I'd love to be able to filter out all the SSRS report jobs that just clutter everything up, or view just the jobs that are in the maintenance category.
2
u/Jerry-Nixon Microsoft Employee May 27 '26
In lieu of Service Broker.
3
u/SQL_US May 13 '26 edited May 14 '26
Patrick, looking at this mainly from an engine architecture and security auditing perspective, here is the reality from the field as I see it:
What I use it for today:
The "clunky and painful":
If I had a wish free:
1
u/60SecTheBaptist May 14 '26
All of our jobs we haven't moved to airflow, are in a msx/tsx configuration. As we migrate etl/elt, maintenance(Ola scripts) , reporting, auditing, etc. We just shut off the job at the msx.
I wish the agent jobs had a wider execution library, with importable extensions for diff languages.
It would be great to be able to disable job steps cleanly with a enabled flag without having to change the "on success" values
Make a better schedules gui so clunky
More functions (I've created some) like ufn_jobName(). Pass it a jobid.. Not every query needs a join between steps and jobs.
Some of these may exist but I've got much of my stuff pinned down so I rarely find I need 4o do stuff outside of a set block of tools.
1
u/jshine13371 6 May 14 '26
I still use it for everything you mentioned. It's a robust yet simple enough tool that I've rarely seen fail. Never had a need to change to a different type of scheduler.
1
u/imtheorangeycenter May 14 '26
All of the above and:
App data "fixes" (heheh) and movement between databases that doesn't need a "proper" ETL job
Super-simoke reporting/alerts to end users
Sync'ing logins between AG replicas (there's probably a DBATools for that, if not some discipline at our end...)
Auto-renaming the GUID SSRS subscription jobs (that's just a me thing)
I'll also misuse it for some task scheduler style jobs, because at least it doesn't fail silently....
1
u/Sea_Refuse_4643 May 15 '26
I would add a Security model to SQL Agent. We have jobs in various categories. Maintenance, App related jobs, Reporting related jobs etc. I would like to give a subset of people access to run or maintain certain jobs but not others. At the moment, there are three system database roles for Agent and that's pretty much it. I would like a role per job category without resorting to custom code.
1
u/srussell705 May 15 '26
Jobs that involve manufacturing data necessary for other operations. Evaluate Product Test data to validate it is in spec, and if not, notify the plant's Quality team of the situation.
Lots of things like that.
1
u/Lost_Term_8080 May 15 '26
maintenance, backups, etls, ssrs, primitive monitoring, staging unscheduled jobs that SQL Sentry can use to run its event chains to recover from certain known failures.
I wish SSRS/PBIRS didn't use SQL agent at all and instead did its task based stuff from the application. If that isn't possible, at least make it possible to more easily identify what an SSRS job does.
The scheduler tool is horrible. Its really easy to inadvertently edit a job that impacts other jobs by trying to create what is believed to be a new schedule. Wish there were a calendar view to view the schedules and jobs instead of having to query it
Would like to see webhooks or some type of API call for alerting
We desperately need to be able to use gmsa for proxy accounts
1
u/Tough_Line3200 May 16 '26
In addition to the use cases you mentioned above, we execute Python notebooks and dbt jobs. It's an incredibly stable scheduler, but we are now transitioning to Airflow. The main reason is moving away from SSIS to Python, notebook, and dbt-based ETL jobs to also benefit from automatic OpenLineage creation. The other reason is the concept of data-aware scheduling via dataset events.
1
u/Black_Magic100 May 13 '26
If I had a magic wand, I'd wish that it never existed 😅
Seriously though, it's an okay scheduler compared to something like Windows Task Scheduler, but I am so happy we are moving to CRON jobs in K8s. Running literally anything in agent jobs is just not that great, but I also don't expect Microsoft to spend the time improving it when alternatives exist.