Setting job schedule

  • Hi,

    I have a job which I would like to run once between the hours of 11pm and 3am.

    The schedule in SSMS does not seem to allow me to specify start and end run times.

    How can I do this?

    Thanks.

  • Have you tried the Starting at and Ending at fields in the Daily frequency section?

    John

  • Hi John,

    I would have to choose it to run every second. So would it start and stop running every second?

    I am running a trace and so would like it to run continuously without any interruptions.

  • The job will start at the time specified in the schedule and run until it finishes. If you're running a trace, you probably need two jobs - one to start it at 11pm and one to stop it at 3am.

    John

  • Ok will do, thanks.

  • If I was to use only one job will the trace still start and stop at specified times?

    If using two jobs would I add my trace script in both jobs or just the start time job?

    Or could I add 2 schedules into the same job one for start and one for stopping?

    What would work best for this?

    Thanks.

  • zedtec (4/1/2014)


    If I was to use only one job will the trace still start and stop at specified times?

    If using two jobs would I add my trace script in both jobs or just the start time job?

    Or could I add 2 schedules into the same job one for start and one for stopping?

    What would work best for this?

    Thanks.

    (1) No, unless sp_trace_start (or whatever it's called) allows you to specify how long the trace will run before it stops

    (2) No, the second one would just run sp_trace_stop (or whatever it's called)

    (3) You can have more than one schedule for the same job, but that wouldn't work here, because you've got two separate tasks. Therefore, the only way to schedule them separately is to put them in separate jobs.

    John

  • It you are talking abou the job you can schedule it to run daily every 10 second between 23:00 to 3:00 hrs. However it won't be possible to set it to schedule every 1 second by single schedule.

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • The sp_trace_create specifies the stop date and time for the trace.

    I guess if I set it a start time it should be ok to stop by itself......

  • You can specify a stop time for a trace. So you just need the job to start it and then it will run until the @stoptime property. You can read more about it in the Books Online.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thanks.

Viewing 11 posts - 1 through 10 (of 10 total)

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