During the deployments, windows
patching or any other activity, DBAs often disable the jobs to avoid data
corruption and jobs failure. Once the activity is completed, DBAs need to
re-enable them.
Since it is a manual intervention, it is possible that a job might be left behind from re-enabling. It happened in my case long time ago and since then I have been extra cautious not to repeat the same mistake again.
I thought to create an alert mechanism that shall help me in identifying if anything is missed.
Sharing the code below, hoping this will help you as well.
Steps:
1) Fetch all the active jobs information in a table
2) Compare the information with the current status
3) Unmatched information should be emailed.
Code: