1

I have a mssql database with some sql job agents for backing up the database. This was done by someone before me and i need to find the script that is being run by the job agent, so i can find out where the database backups are being stored. is there any way i can find this script or procedure that the job agent is executing ? Just to let you know i am not a dba and i have very little knowledge of the db management, so please try to explain as if your explaining to a newbie.

2 Answers 2

3

Since the UI is pretty clunky, I suggest learning where these are stored in the metadata:

SELECT s.step_id, s.database_name, s.command
    FROM msdb.dbo.sysjobsteps AS s
    INNER JOIN msdb.dbo.sysjobs AS j
    ON s.job_id = j.job_id
    WHERE j.name = 'your job name goes here';

You could look at multiple jobs by changing the WHERE clause, you could also do pattern matching against s.command to find steps that reference certain objects...

1

In the SQL Server Agent at the bottom of the Object Explorer, you'll find the Jobs folder. The scripts etc. will be inside these jobs. You can use the Job Activity Monitor to see if any jobs are currently running.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.