O/S Scheduling

Windows NT provides a built-in job scheduling service ("Schedule" under the Control Panel -> Services applet) that can be used to run jobs at predefined dates and times once or repeatedly. Jobs can be O/S commands, BAT or CMD files, EXE's, VBScripts or Jscripts, etc. This schedule service is the key to automating a variety of repetitive DBA tasks, such as:

1) Hot backups

2) Periodic full exports

3) Periodic SQL*Loader jobs

4) Automated startups and shutdowns

5) Table and index ANALYZE jobs

6) Deletion of archive logs

7) Periodic REBUILD of indexes

8) Periodic scanning of ORACLE alert logs for errors.


There are two commands that control the job list run under the schedule service: AT and SOON. AT provides a means to have a job run at a specified date and time, either once or on a regular basis. SOON provides a means to submit a job to be run in batch several seconds in the future. The WinAT utility included in the NT resource provides a graphical user interface to the schedule service. Both of the scheduling commands and the GUI utility accept the computer name as an input parameter, so jobs can be scheduled on remote NT Servers (assuming the security is configured correctly) from a local NT Server or NT Workstation. The commands are particularly useful because they can be included in CMD files to submit a collection of jobs at the same time, have a particular job reschedule itself on the same or a different machine, etc. The help output from these commands, which can be obtained by typing "AT /?" and "SOON /?", is included below.


AT Command

The AT command schedules commands and programs to run on a computer at
a specified time and date. The Schedule service must be running to use
the AT command.

AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE] [ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername Specifies a remote computer. Commands are scheduled on the local computer if this parameter is omitted.
id Is an identification number assigned to a scheduled command.
/delete Cancels a scheduled command. If id is omitted, all the scheduled commands on the computer are canceled.
/yes Used with cancel all jobs command when no further confirmation is desired.
time Specifies the time when command is to run.
/interactive Allows the job to interact with the desktop of the user who is logged on at the time the job runs.
/every:date[,...] Runs the command on each specified day(s) of the week or month. If date is omitted, the current day of the month is assumed.
/next:date[,...] Runs the specified command on the next occurrence of the day (for example, next Thursday). If date is omitted, the current day of the month is assumed.
"command" Is the Windows NT command, or batch program to be run.

SOON Command

Usage : SOON [\\computername] [delay] [/INTERACTIVE] "command"
or : SOON /D [/L:n] [/R:n] [/I:{ON|OFF}]

delay : the number of seconds from now when the scheduled job should start.

/D : modify Default settings and/or display their current values.
/L : set LocalDelay - default delay for Local jobs - initially 5 seconds.
/R : set RemoteDelay - default delay for Remote jobs - initially 15 seconds.
/I : set InteractiveAlways option - initially OFF.

SOON schedules a job to run in the near future, a number of seconds from now. SOON closely resembles the AT command because SOON simply runs a suitable AT command. For a details of the other arguments run "AT /?" without the quotes.

Examples : SOON CMD /C C:\JOBS\BATCH.CMD
SOON 10 CMD /C C:\JOBS\BATCH.CMD
SOON \\SERVER 60 /C \JOBS\BATCH.CMD
SOON \\SERVER /INTERACTIVE CMD /C C:\JOBS\BATCH.CMD
SOON /d /l:2 /r:30 /i:on

Current Settings : InteractiveAlways = OFF
LocalDelay (seconds) = 5
RemoteDelay (seconds) = 15


For usage examples of these commands, please see the article on Scripting.