Sql-server – SQL Agent job does not show up in the jobs folder in SSMS although they are in sysjobs table

sql serversql-server-2008-r2sql-server-agent

I tried to copy some SQL Agent Jobs from server1 to server2 by selecting rows from server1.msdb.dbo.sysjobs and inserting to server2.msdb.dbo.sysjobs. I did the same with sysjobsteps.

This seemed to work, and I verified that the records are in the new msdb tables.

Once I restart SQL Agent, I only see some of those jobs listed under SQL Server Agent in SSMS. I am very puzzled why SOME are not listed.

I am using SQL Server 2008 R2.

Best Answer

A better option might be to script the jobs out instead of taking the information directly out of the system tables. In SSMS just right click each job and it should give you the option to script to a new query window or file.

Scripting the jobs out in this manner is probably the most affective, short of just restoring the msdb database to the other instance. You can review the script before running it on your second server and ensure the job steps and schedule looks right. If you have any that run frequently you might adjust the script to have those created as disabled, so you can verify first.

There are a few things that might affect why your pocess did not work, one being the order in which you inserted them and ensuring that the records or linked by the jobid like they should be.