Overview
This document describes how to create and execute Job objects, and how to monitor them.
Version
Altibase version 6.3.1 or later
How to use
To create a Job object and operate normally, the user must proceed in the following order.
- Enable the task scheduler function
- Create the procedure to register in the Job object
- Create the Job object
- Enable the Job object (only performed on Altibase 6.5.1 or later. Altibase 6.3.1 is not applicable)
- Check the Job object and execution result
Enabling the task scheduler function (Altibase Server Property Settings)
If the user is using the Job object for the first time, the job scheduler function must be enabled by changing the following Altibase server properties.
The job scheduler performs a procedure according to the settings registered in the job object.
- JOB_SCHEDULER_ENABLE : Task Scheduler Enable settings
- JOB_THREAD_COUNT : Number of threads to execute Job object
Both of the above properties must be set to 1 to use the task scheduler. The default value is 0, so be sure to check if the user is using Task Scheduler for the first time.
The JOB_SCHEDULER_ENABLE property can be changed even when the Altibase server is running, but to change the value of the JOB_THREAD_COUNT property, the Altibase server must be restarted.
Therefore, when using the task scheduler for the first time, change the properties according to the procedure below.
1. Stop the Altibase server
2. Find the JOB_SCHEDULER_ENABLE and JOB_THREAD_COUNT properties in the altibase.properties file, change the value to 1, and save.
3. Start the Altibase server
4. Check the property setting value
Creating the procedure
Create a procedure to be registered in the Job object and check if the procedure is executed normally.
The reason for checking whether the procedure is normally executed is to exclude the possibility of a procedure problem if the Job object does not operate as set by the job scheduler.
Creating the Job object
Create a JOB object.
The stored procedure to be executed, execution time, and execution cycle can be set in the JOB object. For the statement of creating a JOB object, refer to the SQL Reference manual. (Manual download page: http://support.altibase.com/en/manual or https://github.com/ALTIBASE/Documents/tree/master/Manuals/)
Enabling the job object
This operation is an added procedure with the addition of a function to enable/disable a specific JOB in Altibase version 6.5.1.
In Altibase version 6.3.1, when creating a JOB object, it becomes 'enabled' immediately, but from Altibase 6.5.1, if the ENABLE option is not used in the CREATE JOB statement, it is 'disabled'.
Therefore, starting from Altibase version 6.5.1, after creating a Job object, in order to make the Job run, it must be changed to the enabled state.
The change method is as follows.
Starting from Altibase version 6.5.1, it is also possible to set it to "Enabled" immediately when creating a Job object.
Check the Job object and execution result
The user can check the job object information and job execution result with the query below.
Related Properties
JOB_SCHEDULER_ENABLE
Property description
- This property is to enable or disable the task scheduler function.
- The default value is 0, which disables the task scheduler.
How to change the set value
It can be changed by using ALTER SYSTEM.
How to check the set value
The JOB_SCHEDULER_ENABLE set value can be checked with the query below.
JOB_THREAD_COUNT
Property description
- This property configures the number of threads to process a job.
- The default value is 0. When the Altibase server is started, the thread for executing the task scheduler is not started.
- If JOB_THREAD_COUNT is set to a value other than 0, JobScheduler threads and JobThread threads as many as JOB_THREAD_COUNT are started.
- Job is not executed by the service thread, but are processed by a thread called JobThread. So, if the user wants the job to be executed by the job scheduler, this property must be set.
- Change this property value requires restarting the Altibase server.
How to change the set value
- Stop the Altibase server.
- Find JOB_THREAD_COUNT in $ALTIBASE_HOME/conf/altibase.properties, change the value, and save.
- Start the Altibase server.
How to check the set value
The JOB_THREAD_COUNT set value can be checked with the query below.
JOB_THREAD_QUEUE_SIZE
Property description
- This property sets the number of queues to process multiple job objects are executed at the same time.
For example, when 4 job objects are executed at the same time by the job scheduler, they are processed in the following order according to the number of JOB_THREAD_COUNT and JOB_THREAD_QUEUE_SIZE.
- JOB_THREAD_COUNT = 4, JOB_THREAD_QUEUE_SIZE = 1: 4 can be executed at the same time
- JOB_THREAD_COUNT = 2, JOB_THREAD_QUEUE_SIZE = 2: Two are executed at the same time, and the other two are executed consecutively.
- JOB_THREAD_COUNT = 1 ,JOB_THREAD_QUEUE_SIZE = 4: 1 is executed at the same time and the remaining 3 are executed consecutively. - The default and minimum values are set large enough to 64, so there is no need for users to set them arbitrarily.
- To change the value of this property with the Read-Only attribute, the Altibase server must be stopped.
How to change the set value
- Stop the Altibase server.
- Save after changing JOB_THREAD_QUEUE_SIZE in $ALTIBASE_HOME/conf/altibase.properties.
- Start the Altibase server.
How to check the set value
The JOB_THREAD_QUEUE_SIZE set value can be checked with the query below.
Reference
The following are manuals for the description of the task scheduler.
Administrator's Manual> 5. Database Objects and Permissions> Job
SQL Reference> 3. Data Definition Language> ALTER JOB /
SQL Reference> 3. Data Definition Language> CREATE JOB
SQL Reference> 3. Data Definition Language> DROP JOB
General Reference> 2. ALTIBASE HDB Properties> Other Properties
General Reference> 3. Data Dictionary> SYS_JOBS_
- Manual Download Page: http://support.altibase.com/en/manual or https://github.com/ALTIBASE/Documents/tree/master/Manuals/