The JS Task determines when scheduled jobs should run and creates a historical record of jobs that are run. It starts the JS Agent process and feeds it the necessary information to retrieve job information and run the job on the specified ASE.
When the JS Agent retrieves the job information from Job Scheduler’s own database, called sybmgmtdb, it logs into the target ASE and issues the job commands. When the job completes, JS Agent logs any result or output to the log tables in the sybmgmtdb database.
All of the information about jobs, schedules, scheduled jobs, and data needed by the JS Task for internal processing is stored in the sybmgmtdb database, where data is usually accessed through stored procedures. The stored procedures make the data available to the GUI, the JS Agent, and the command-line interface. Only the JS Task accesses data directly from the sybmgmtdb database.
Using the data it receives, the GUI helps you create and schedule jobs, view job status and job history, and control jobs. It also provides an administration feature that turns the ASE internal task on and off and, therefore, allows Job Scheduler to process and execute scheduled jobs.
Templates are an important tool in defining parameterized tasks for self-management of the database, such as database backups, reorganization rebuilds, modification of configuration parameters, and statistics updates and monitoring. They are implemented as batch T-SQL commands for which you provide parameter values. Database administrators can use templates to generate jobs schedule them to run at specific times.
Figure 1-1 shows the various components that form the Job Scheduler architecture.
Figure 1-1: Job Scheduler architecture
As shown, the client GUI and the command line interface interact with the Job Scheduler database tables using stored procedures. Then, the stored procedures perform the actions requested by the user and maintain the definitions of the job commands, schedules, and other job information in the database tables.
The JS Task reads the job and schedule information from these tables and determines when a scheduled job needs to be executed. At the appropriate times, the JS Task informs the JS Agent of the job that needs to be run. Then the JS Agent retrieves the job information and executes it on the target ASE database, which can be either local (on the same server as Job Scheduler), or remote (anywhere outside the JS Agent, including on the same server Job Scheduler is installed on). The JS Agent collects the output and any result sets and stores this output in the appropriate tables in the Job Scheduler sybmgmtdb database.