The SET_ATTRIBUTE procedure is used to modify the attributes of a Scheduler object.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
DBMS_SCHEDULER.SET_ATTRIBUTE (
name IN VARCHAR2,
attribute IN VARCHAR2,
value IN VARCHAR2);
Parameters
| Parameter | Description |
|---|---|
| name | The name of the object. The system-defined scheduled tasks are as follows:
|
| attribute | See Value below. |
| value | The new value for the attribute, which cannot be NULL. |
Attribute value
Job attributes
The current version of OceanBase Database supports the following job-related attributes.
| Attribute name | Description |
|---|---|
| auto_drop | This attribute can be set to TRUE or FALSE. If set to TRUE, the job is automatically deleted after it completes or is disabled. A job is considered completed if any of the following conditions are met:
max_failures times. max_failures is also set by using SET_ATTRIBUTE. If auto_drop is set to FALSE, the job is not deleted and its metadata is retained until you explicitly drop the job by using the DROP_JOB procedure. By default, auto_drop is set to TRUE when you create a job.
NoteThis attribute is not supported in the current version. |
| comments | Comments. This is an optional attribute.
NoteThis attribute is not supported in the current version. |
| credential_name | The name of the credential object used for the job. For a local database job, this value must be NULL. For a local external job, if this attribute is NULL (the default), the preferred (default) credential is selected.
NoteThis attribute is not supported in the current version. |
| destination_name | The name of the database or external destination for the job. This attribute is applicable only to remote database and remote external jobs. For a job running on a local database or a local external job (executable), this attribute must be NULL.
NoteThis attribute is not supported in the current version. |
| end_date | The date and time when the job expires and no longer runs. After end_date, if auto_drop is TRUE, the job is deleted. If auto_drop is FALSE, the job is disabled and its STATE is set to COMPLETED. If you do not specify a value for end_date, the job is repeated indefinitely, unless max_runs or max_failures is specified. In that case, the job stops running when either of these values is reached. The value of end_date must be later than the value of start_date, or an error is returned. If the value of end_date is the same as the value of start_date, the job is not executed, and no error is returned.
NoteThis attribute is not supported in the current version. |
| job_action | The action to be performed by the job, which depends on the value of the job_type attribute. For example, if the job type is STORED_PROCEDURE, job_action contains the name of the stored procedure. |
| job_class | The class associated with this job. |
| job_name | The name of the job. The name must be unique in the SQL namespace. If the job belongs to another schema, you must qualify the name with the schema name. If you do not specify a job name, an error is returned. You can also use the GENERATE_JOB_NAME procedure to generate a name by the scheduler. The generated name is a sequence number, which can be prefixed with a string. The job name is then a string with a sequence number, and is used in the CREATE_JOB procedure.
NoteThis attribute is not supported in the current version. |
| job_priority | This attribute specifies the priority of the job relative to other jobs in the same class. If multiple jobs in a class are scheduled to run simultaneously, the job priority determines the order in which the jobs are executed. It can be a value from 1 to 5, where 1 indicates the job that is executed first. If you do not specify a job priority when you create a job, the default priority is 3.
NoteThis attribute is not supported in the current version. |
| job_type | The type of the job to be created. If you do not specify a value, an error is returned. Only STORED_PROCEDURE is supported. If you specify this attribute, program_name must be NULL.
NoteThis attribute is not supported in the current version. |
| max_failures | This attribute specifies the maximum number of consecutive failures before the job is disabled. Once disabled, the job will no longer execute. max_failures can be an integer from 1 to 1,000,000. The default value is NULL, which means that a new instance of the job is started regardless of how many times previous instances failed. |
| max_runs | This attribute specifies the maximum number of times the job can run consecutively. Once this maximum is reached, the job is disabled and its status is changed to COMPLETED. The maximum number of runs can be an integer from 1 to 1,000,000. The default value is NULL, which means that the job is repeated indefinitely until it reaches the value of end_date or max_failures.
NoteThis attribute is not supported in the current version. |
| number_of_argument | The number of parameters for the inline program job. If you specify this attribute, program_name must be NULL.
NoteThis attribute is not supported in the current version. |
| program_name | The name of the program associated with this job. If the program type is EXECUTABLE, the values of job_action, job_type, and number_of_arguments must be NULL.
NoteThis attribute is not supported in the current version. |
| repeat_interval | A PL/SQL function that returns the next scheduled date and time, or a calendar syntax expression. |
| start_date | The initial date and time when the job starts or is scheduled to start. If you specify this attribute, schedule_name must be NULL.
NoteThis attribute is not supported in the current version. |
| instance_id | By default, jobs are executed in the Primary Zone. instance_id specifies the ZONE where the job is executed. If you specify instance_id as RANDOM (that is, set the value parameter in the subprogram to RANDOM), the job is randomly assigned to all ZONEs. |
| next_date | The next scheduled date and time for the job. |
| max_run_duration | Specifies the maximum duration for which the job can run. |
Procedure attribute values
| Parameter | Description |
|---|---|
| comments | Optional comments that describe the functionality or usage details of the procedure. |
| number_of_arguments | The number of parameters required by the procedure. |
| program_type | The type of the procedure. Currently, only the STORED_PROCEDURE type is supported. |
| program_action | The operation performed by the procedure, specified by the program_type attribute. For example, if the program type is STORED_PROCEDURE, then program_action contains the name of the stored procedure. |
Considerations
If you want to change an enabled object, the Scheduler disables it first, makes the changes, and then reenables it. If an error occurs during the enablement process, the object is not reenabled, and an error message is generated. If you change a disabled object, the object remains disabled after the changes.
For jobs:
If a job has a running instance when
SET_ATTRIBUTEis called, the instance is not affected by the call. The changes only affect the job's future executions.If you change any schedule-related attributes of a running job, the changes will be used to schedule the next execution of the job. Schedule-related attributes include
schedule_name,start_date,end_date, andrepeat_interval.If you change any program-related attributes of a running job, the changes will take effect during the next execution of the job. Program-related attributes include
program_name,job_action,job_type, andnumber_of_arguments.If you change any job parameters during the execution of a job, the changes will take effect during the next execution of the job.
If you change the schedule, the changes do not affect the currently running job. The changes will only take effect during the next execution of the job.
For programs, if you modify the program that a job is currently running, the job will continue to use the previous attribute values to execute the program. During the next execution of the job, the job will use the new attribute values to execute the program.
Examples
Set the next scheduled time of the partition balancing task to 01:00 on June 12, 2024.
obclient(SYS@oracle001)[SYS]> CALL DBMS_SCHEDULER.SET_ATTRIBUTE( name => 'SCHEDULED_TRIGGER_PARTITION_BALANCE', attribute => 'next_date', value => '12-JUN-2024 01:00:00 AM' );Or
obclient(SYS@oracle001)[SYS]> CALL DBMS_SCHEDULER.SET_ATTRIBUTE('SCHEDULED_TRIGGER_PARTITION_BALANCE', 'next_date', '12-JUN-2024 01:00:00 AM');Set the next scheduled time of the window merging task to 01:00 on March 10, 2026.
obclient(SYS@oracle001)[SYS]> CALL DBMS_SCHEDULER.SET_ATTRIBUTE( name => 'DAILY_MAINTENANCE_WINDOW', attribute => 'next_date', value => '10-MAR-2026 01:00:00 AM' );Or
obclient(SYS@oracle001)[SYS]> CALL DBMS_SCHEDULER.SET_ATTRIBUTE('DAILY_MAINTENANCE_WINDOW', 'next_date', '10-MAR-2026 01:00:00 AM');
