Follow sqlserver-dba.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

SQLServer-DBA.com Links

Dba_db2_button

dba-ninja.com

SQL Server DBA Jobs

Disable a SQL Agent Job not working

17 November,2022 by Tom Collins

Question: I have a  SQL Server Agent job  in a disabled status. The disabled status is  applied to the SQL Agent Job and the associated schedule.  The problem is I'm logged on as a full administrator onto the Windows Server - and as BUILTIN\Administrator is defined on the SQL Server , but am able to manually override the SQL Agent Job.   

Is there a way to Disable the SQL Agent Job where I'm not able to manually override the job?

Answer:   There is no way to disable a SQL Agent Job where it cannot be run manually. The disabled option on a SQL Agent Job  stops the job running as a SQL Agent scheduled job.   I've specified SQL Agent Job because if another schedule  tool such as Autosys is used and triggers a script - than the SQL Agent job will be executed .

For example if using SMO through Powershell and start a disabled SQL Agent job in the context of an ID with suitable privileges , then the job will run 

[Microsoft.SqlServer.Management.Smo.Agent.Job]$job = ($sqlServer.JobServer.Jobs | ? { $_.Name -eq 'MySQLAgentJob' });

$job.Start();

There are certain strategies you could apply :

1) Review access to the elevated ID privilege

2) Delete the Job 

3) Amend in some way for the job to fail 

 

Read more on managing SQL Agent 

List enabled status of SQL Server Agent Jobs

How to check if SQL Server Agent is running using t-sql

How to schedule a SQL Server Agent Job to execute once a year ...


Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Disable a SQL Agent Job not working


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer