RSS
rajkumar.subrayan

Job Scheduler in Sybase ASE

Fri, Oct 5, 2012

rajkumar.subrayan

Job Scheduler in Sybase ASE
Job Scheduler eases the management of ASE by providing the ability to define and schedule database administration and maintenance tasks. With Job Scheduler, jobs that normally require interaction from a database administrator can be scheduled to run unattended at the appropriate times, freeing the database administrator to attend to other issues. Job Scheduler allows you to create and schedule jobs, and to share jobs and schedules. One database administrator can create a job, and other database administrators can then schedule and run that job on another server. You can create jobs as follows:

• From scratch using the command line or GUI
• From a SQL batch file
• From a template

Job Scheduler captures the results and output of jobs and records that information in log tables. This data can be viewed at a later date. In addition, Job Scheduler keeps a history of scheduled jobs; however, to keep a limit on the size of the history table, Job Scheduler monitors it and removes outdated, unnecessary history records.

Terminology and concepts
This section explains some of the basic concepts and terminology associated with using Job Scheduler.

Terminology:
• A job is a series of one or more actions performed on a database in a single operation, such as backing up, updating statistics, and dumping a database.
• A schedule defines a timescale for how and when jobs are executed and re-executed.
• A scheduled job is a job that has been bound to a schedule. Only scheduled jobs are executed.
• The Job Scheduler Task (JS Task) is the functional component responsible for managing the schedules and providing timely notification to the Job Scheduler Agent to execute a particular job.

• The Job Scheduler Agent (JS Agent) is the functional component responsible for executing a job when notified by the JS Task.

• A repeating schedule is a schedule that is active more than once. All repeating schedules must have both start and end times.

• A target server is the Adaptive Server® on which a job is scheduled to run.
• A template is a set of Transact-SQL (T-SQL) statements with parameters that can be used to create a job within the Job Scheduler.

Concepts:
JS Task wakes up on demand, either by a job scheduled to be run or by a wake-up event that has occurred, such as the creation of a new job. At regular intervals (configurable by the database administrator), JS Task scans the sybmgmtdb database tables and collects applicable schedule information to maintain its dedicated server tables js_callouts and js_history. The JS Task performs the functions that allow Job Scheduler to perform its internal tasks. It is also what makes Job Scheduler run time programmable within ASE.

Job Scheduler components and functionality

Job Scheduler consists of the following components:
• An internal ASE task called the JS Task

• An external process called the JS Agent
• The sybmgmtdb database and stored procedures
• The graphical user interface (GUI) using the ASE plug-in in Sybase® Central
• Predefined templates from which the database administrator can create and schedule useful, time-saving jobs

The following list of tasks makes up the basic functionality of Job Scheduler and can be performed at the command line or in the Sybase Central graphical management tool:
• Create a job, schedule, or scheduled job
• Modify a job, schedule, or scheduled job
• Delete a job, schedule, or scheduled job
• Review job history


Job Scheduler architecture

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.

Process flow:
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.

Popularity: 49% [?]

Leave a Reply