|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Advanced Oracle Utilities: The Definitive Reference by Rampant TechPress is written by top Oracle database experts (Bert Scalzo, Donald Burleson, and Steve Callan). The following is an excerpt from the book.
Using the Windows Job Scheduler SCHTASKS.EXE
The
SCHTASKS
command was introduced in Windows XP and Windows 2003 as a more flexible and
slightly more verbose replacement for the ATcommand.
The AT command is still available for backwards compatibility, but it
is no longer the preferred command line scheduling method.
As
with Windows 2000, the simplest way to schedule jobs in Windows XP and
Windows 2003 is via the Scheduled
Tasks Wizard.
However, the SCHTASKS
command provides a command line API for situations in which a command line
approach is preferable.
The
usage notes for the SCHTASKS
command are very comprehensive and include examples as well as basic syntax.
The top-level usage notes are displayed below with examples indicating
how more parameter specific usage notes can be obtained. C:\>SCHTASKS /? SCHTASKS /parameter [arguments] Description:
Enables an administrator to create, delete, query, change, run
and
end scheduled tasks on a local or remote system. Replaces AT.exe. Parameter List:
/Create
Creates a new scheduled task.
/Delete
Deletes the scheduled task(s).
/Query
Displays all scheduled tasks.
/Change
Changes the properties of scheduled task.
/Run
Runs the scheduled task immediately.
/End
Stops the currently running scheduled task.
/?
Displays this help/usage. Examples:
SCHTASKS
SCHTASKS /?
SCHTASKS /Run /?
SCHTASKS /End /?
SCHTASKS /Create /?
SCHTASKS /Delete /?
SCHTASKS /Query /?
SCHTASKS /Change /?
To
schedule a job that runs the
c:\jobs\MyJob.bat script at 9:00 p.m. on Mondays, Tuesdays,
Thursdays and Fridays, the following commands would be used: SCHTASKS /Create /TN MyJob /TR C:\Jobs\MyJob.bat /ST The task will be created under current logged-on user
name ("tim_hall"). Please enter the run as password for tim_hall: ****** SUCCESS: The scheduled task "MyJob" has successfully been
created.
Once a task is created, it can be viewed by issuing the
SCHTASKS
command with no parameters: C:\>SCHTASKS TaskName
Next Run Time
Status ====================================
========================
MyJob
Tasks that are no longer needed can be deleted using the /delete option: C:\>SCHTASKS /delete /TN MyJob WARNING: Are you sure you want to remove the task "MyJob"
(Y/N )? y SUCCESS: The scheduled task "MyJob" was successfully
deleted. C:\>SCHTASKS INFO: There are no scheduled tasks present in the system.
Since some of the external schedulers available on the most common operating
systems have been presented, the following section will focus on the internal
schedulers provided by the Oracle database.
Internal Oracle Job Scheduling
The
Oracle scheduler allows jobs to be scheduled to run at a later date or on a
repeating cycle. Information
about the scheduling session’s environment is stored along with the scheduled
job, allowing jobs to run in a consistent environment each time.
Scheduled jobs are placed on a job queue that is managed by a
coordinator process which periodically scans the job queue looking for jobs
to execute. When necessary, the
coordinator process spawns job slaves to execute the jobs.
The basic architecture of the Oracle scheduler is shown in Figure
11.12.
Figure 11.12 –
Oracle Scheduler Architecture
The
basic architecture of
dbms_job and
dbms_scheduler schedulers may be similar, but the functionality
and associated APIs are quite different.
The Oracle 9i scheduler is extremely basic and a little clumsy,
whereas the Oracle 11g scheduler is packed with features allowing job
scheduling to be as simple or complicated as desired.
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright © 1996 - 2011 by
Burleson Enterprises. All rights reserved.
Oracle® is the registered trademark
of Oracle Corporation. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||