Hi, I'd like to add upon squillman's answer. I tested it in 2008 R2.
First, by fixing the error with FK violation with sysjobschedules and sysschedules.
Secondly, by running dbo.sp_add_jobserver.
Lastly, by having it loop through all the jobs in msdb_old.dbo.sysjobs for a complete replication.
DECLARE @JobID UNIQUEIDENTIFIER
declare @jobname nvarchar(128)
DECLARE MY_CURSOR CURSOR
LOCAL STATIC READ_ONLY FORWARD_ONLY
FOR
SELECT DISTINCT job_id
FROM msdb_old.dbo.sysjobs
OPEN MY_CURSOR
FETCH NEXT FROM MY_CURSOR INTO @JobID
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @jobname = name FROM msdb_old.dbo.sysjobs WHERE job_id=@jobid
print @jobname
print 'insert in sysjobs'
INSERT msdb.dbo.sysjobs
SELECT * FROM msdb_old.dbo.sysjobs
WHERE job_id=@JobID
print 'insert in sysjobsteps'
INSERT msdb.dbo.sysjobsteps
SELECT * FROM msdb_old.dbo.sysjobsteps
WHERE job_id=@JobID
print 'insert in sysjobhistory'
SET IDENTITY_INSERT msdb.dbo.sysjobhistory ON
INSERT msdb.dbo.sysjobhistory
(instance_id,job_id,step_id,step_name,sql_message_id,sql_severity,
[message],run_status,run_date,run_time,run_duration,operator_id_emailed,
operator_id_netsent,operator_id_paged,retries_attempted,[server])
SELECT
instance_id,job_id,step_id,step_name,sql_message_id,sql_severity,
[message],run_status,run_date,run_time,run_duration,operator_id_emailed,
operator_id_netsent,operator_id_paged,retries_attempted,[server]
FROM msdb_old.dbo.sysjobhistory
WHERE job_id=@JobID
SET IDENTITY_INSERT msdb.dbo.sysjobhistory OFF
print 'insert in sysschedules'
SET IDENTITY_INSERT msdb.dbo.sysschedules ON
INSERT msdb.dbo.sysschedules
( [schedule_id]
,[schedule_uid]
,[originating_server_id]
,[name]
,[owner_sid]
,[enabled]
,[freq_type]
,[freq_interval]
,[freq_subday_type]
,[freq_subday_interval]
,[freq_relative_interval]
,[freq_recurrence_factor]
,[active_start_date]
,[active_end_date]
,[active_start_time]
,[active_end_time]
,[date_created]
,[date_modified]
,[version_number])
SELECT s.[schedule_id]
,s.[schedule_uid]
,s.[originating_server_id]
,s.[name]
,s.[owner_sid]
,s.[enabled]
,s.[freq_type]
,s.[freq_interval]
,s.[freq_subday_type]
,s.[freq_subday_interval]
,s.[freq_relative_interval]
,s.[freq_recurrence_factor]
,s.[active_start_date]
,s.[active_end_date]
,s.[active_start_time]
,s.[active_end_time]
,s.[date_created]
,s.[date_modified]
,s.[version_number]
FROM msdb_old.dbo.sysschedules s, msdb_old.dbo.sysjobschedules j
WHERE j.job_id=@JobID and s.schedule_id = j.schedule_id
SET IDENTITY_INSERT msdb.dbo.sysschedules OFF
print 'insert in sysjobschedules'
INSERT msdb.dbo.sysjobschedules
SELECT * FROM msdb_old.dbo.sysjobschedules
WHERE job_id=@JobID
print'exec adds job in server'
use msdb
EXEC dbo.sp_add_jobserver @job_id = @jobid
FETCH NEXT FROM MY_CURSOR INTO @JobID
END
CLOSE MY_CURSOR
DEALLOCATE MY_CURSOR