Sql-server – Backup of Job’s List only

backupsql serversql-server-2008-r2sql-server-agent

Goal:
Reuse the SQL server agent jobs list.

Problem:
The list contains a lot of jobs and I need to reuse the jobs list in a another time without recreating it.

Based on the example of the picture, can I get the sourcecode of every job and enable reusing it when I establish a new database from scratch?

I would prefer not to recreate the job list from scratch.

Information:
*The list contains a lot of jobs.

enter image description here

Best Answer

I've built a command-line utility that creates a .sql script file containing T-SQL that will recreate all SQL Server Agent Jobs for the specified SQL Server instance.

The utility takes several command-line parameters, as below, which necessitates running it from the command prompt, cmd.exe.

MVCTSQLJobScripter.exe /server:localhost /outfile:C:\temp\AgentJobs.sql

Be aware that this tool comes with no warranties, and is use at-your-own-risk. I have used it on my own SQL Servers, and it works for me.

The utility uses the Microsoft.SqlServer.Management.Smo.Agent.Job.Script method to output T-SQL, so the output should be precisely what is needed to recreate jobs.

You can download the binary and prerequisites from http://blog.mvct.com/technology/tool-for-scripting-sql-server-agent-jobs/

There are also many commercially available products that provide various features to move or copy jobs from server to server, such as the Idera SQL Admin Toolset. I neither work for, nor am I associated with Idera in any way.