Job and Schedule management

Like most DBMS-es, Querona supports used-defined recurrent task called a job. To define a job, a schedule should be defined first. Querona mimics job management implementation after Microsoft SQL Server so users can define job using GUI or using SQL.

Schedules

Schedules can be found under Administer ‣ Schedule management.

Schedule management screen

The screen supports searching. A new schedule can be defined by clicking the Add schedule button.

Add schedule

The following schedule types apply:

Once

The linked job will be run once on the given day/time.

Run once schedule

Daily

Scheduled tasks will be run once or more than once per day on a given time.

Daily schedule
  • Recurs every N days means a given tasks will be run every n days.
  • Daily frequency can be set a specific time of day or a recur value (e.g. Every N minutes) with additional daily time bounds.
  • Start date and optional End date can be used to globally limit the schedule time span.

Weekly

This schedule is used to configure tasks to be run on particular days of the week.

Weekly schedule

It behaves the same way as the daily schedule except for multiple days of the week can be selected.

Monthly

To run a job on given day of the month this option is the right choice.

Monthly schedule

Again, either a specific time or time-bound recurrence can be selected.

Jobs

Jobs can be found under Administer ‣ Job management.

Jobs management screen

The screen supports searching. A new job can be defined by clicking the Add job button or using SQL.

Add job

Input a name and description and click Create. This will cause the job to be saved and appear on the list.

Click the job on the list to access the details pane. In the bottom, you will find 3 sub-blades that allow tuning of the job details.

Job details

The Start job buttons allow running the job at any time.

Clicking Steps brings up the job step configuration screen. A single job can consist of any number of step. A new step can be defined by clicking the Add step button.

Job step add

The following table summarizes the parameters:

Parameter Description Default value
Step Id Auto-generated Id of the step, used for jumps (see below).  
Step Name A user-friendly name of the step.  
Command An arbitrary SQL to be run on the target database.  
On success action The action to be performed when the step succeeds. Choosing Go to specified step allows to set the Id of the target jump step. Go to next step
On fail action The action to be performed when the step fails. Choosing Go to specified step allows to set the Id of the target jump step. Quit with failure
Database name The target database that this step will run on.  

Clicking Save will save the step and return to the step list.

Past execution attempts of a given job can be found under Execution history.

Jobs history

The Schedules section allows to link an arbitrary number of Scheduler to the given job:

Job schedules

This can be achieved by clicking the Add schedule button and picking the proper positions.

Job management using SQL

A SQL Server compatible stored procedures can be used to manage jobs.

In the following example, we:

  • define a job,
  • add a custom task to it,
  • define a schedule,
  • attach the schedule to the job,
  • execute the job explicitly.
exec sp_add_job @job_name = 'myjob'

exec sp_add_jobstep @job_name = 'myjob', @step_name = 'step1', @command = 'select 1'

.. code-block:: SQL

exec sp_add_schedule @schedule_name = 'every_10_seconds',
    @freq_type = 4,            -- daily
    @freq_subday_type = 2,     -- subday interval seconds
    @freq_subday_interval = 10 -- every 10 seconds

exec sp_attach_schedule @job_name = 'myjob', @schedule_name = 'every_10_seconds'
exec sp_start_job @job_name = 'myjob' -- execute job once