I can't find documentation about whether agent jobs in SQL Server can be backed up. If not, how can I back them up in order to restore during the future recovery in case of an instance failure?

  • 2
    The backup jobs and any other jobs are stored in MSDB so just backup msdb and you can restore it if the version of SQL Server is same where you are restoring. You also have option to script out all the jobs and save it as script
    – Shanky
    Commented Oct 16, 2018 at 15:38
  • 1
    backup the msdb database
    – DimUser
    Commented Oct 16, 2018 at 15:41

3 Answers 3


SQL agent jobs are stored in the system msdb database, so backing up that database will do what you need.

In a disaster, you can restore the entire msdb database, or, if necessary, recover individual jobs from a restored copy of msdb:

Serverfault: Recovering a specific job definition from an MSDB backup?

If you want them in a more immediately usable format, you can right-click and script out individual jobs manually, or if you'd like to script out all jobs on the server at once:

Stack Overflow: Automatically create scripts for all SQL Server Jobs


Another way is to just export to file using dbatools

Get-DbaAgentJob -SqlInstance workstation\sql2016 |  Export-DbaScript

you can even script out your entire instance or subset including agent jobs, operators, logins, etc for disaster recovery purpose.

Edit: Above will have the flexibility to filter out jobs that you do not need. Backup / restore of msdb is all jobs.. just FYI.

  • 4
    +1 for thinking outside of the box!
    – DimUser
    Commented Oct 16, 2018 at 15:47

I know this is an old question already answered but you can press F7 with the folder JOBS selected. then you can select all jobs and right click them, script jobs as > create. It will create the script for all jobs.

Your Answer

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

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