Jobs Steps and Schedules

  • -- Creates job

    declare @JobID uniqueidentifier

    exec sp_add_job

    @job_name = 'Backup',

    @enabled =1,

    @notify_level_eventlog =3,

    @job_id = @JobID OUTPUT

    --Creates job step

    EXEC sp_add_jobstep @job_name = 'Backup',

    @step_name = 'backup data',

    @subsystem = 'TSQL',

    @command = 'exec usp_BackupDatabase',

    @database_name = 'TRACEBASE_CORE', -- where the sprco above lives

    @retry_attempts = 5,

    @retry_interval = 5

    --Schedules Job

    EXEC sp_add_jobschedule @job_name = 'Backup',

    @name = 'ScheduledBackup',

    @freq_type = 4, -- daily

    @freq_interval = 1,

    @active_start_time = 130000 -- 1pm

    I have created the above to create a daily run of the stored procedure usp_BackupDatabase (no prizes for guessing what this does) I set it for One to make sure it works but it did not.... I have run the stored procedure independantly which works fine... am I doing anything silly in the setup????

  • Who is the job owner? you need to set up job owner. You can use the same account as the one you used when you manually ran the SP.

     

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply