Sql-server – SQL Server Agents jobs and turning off the server

sql server

I'm really new to SQL Agent jobs, but I am attempting to build up a maintainance regime for a server that will be turned off and on again at unknown intervals. It may run without being shutdown for a month, or it might only be turned on 9-5… we don't know and the client can't tell us because they don't know.

So what I'm wondering is, what do I need to do to get SQL Server to run monthly and daily jobs either when they are due, or if the due date is missed, get them to be run when the server is next powered on. I could come up with a mish-mash of periodic jobs and 'on-power-up' jobs, but if there is something more elegant that would be wonderful.

Obviously I'll need to ensure the SQL Server Agent is configure to start when the computer is powered up, but what else?

Best Answer

Your options for sql server agent schedule events are:

  1. Whenever SQL Server Agent starts.
  2. Whenever CPU utilization of the computer is at a level you have defined as idle.
  3. One time, at a specific date and time. On a recurring schedule.

If you need something that handles more events then you can always do something like use the Windows scheduler and call sqlcmd that executes sp_start_job or could even execute the BACKUP DATABASE commands directly.

Related Topic