SQL Agent Jobs

  • I have a developer who want's to run sql agent jobs as temporarily. Like create the sql agent job dynamically, run (job is very simple) and when the job completes then delete it on fly. Would you see any problems doing this way? Otherwise do you recommend any other options? Please advise?

  • Permissions would be the only concern. Is the developer doing this in a test/dev environment? If so, then it should be fine. If it is in production, I would be a little concerned with the permissions needed to accomplish the task.

    There are roles that can be used to grant this type of task, but my experience with them has left a lot to be desired and it usually was much easier for me as the DBA to just do it for the person wanting to "play" with SQL Agent jobs. These roles are in the msdb database and are named "SQLAgentOperatorRole", "SQLAgentReaderRole", and "SQLAgentUserRole". If you google those terms (or just SQL Agent Roles), you'll see the difference in what they do.

    • This reply was modified 4 years, 8 months ago by  SQL_Hacker.

    Alan H
    MCSE - Data Management and Analytics
    Senior SQL Server DBA

    Best way to ask a question: http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Admingod wrote:

    I have a developer who want's to run sql agent jobs as temporarily. Like create the sql agent job dynamically, run (job is very simple) and when the job completes then delete it on fly. Would you see any problems doing this way? Otherwise do you recommend any other options? Please advise?

    The fact that jobs run asynchronously may also make this approach tougher than you think ... the developer would have to keep polling to find out whether the job execution was complete.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • I have to ask - why does the developer want to create an agent job, execute it - then drop it?  What is the purpose behind this request and how would that be a better option than to just execute the code from a stored procedure?

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply