The STOP_JOB procedure is used to terminate a running job.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only MySQL-compatible mode.
Privilege requirements
The sys tenant can terminate jobs running for other users. Other users can only terminate their own running jobs.
Syntax
DBMS_SCHEDULER.STOP_JOB (
job_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE);
Parameters
Parameter |
Description |
|---|---|
| job_name | The name of the job. Only one job name can be specified. |
| force | Specifies whether to forcibly terminate the running job. Only FALSE is supported, indicating that the job will not be forcibly terminated. |
Considerations
- Terminating multiple job runs: When the
STOP_JOBstatement is executed, all jobs and their corresponding sessions that were started before the execution time will be terminated. - Impact on future scheduling: The
STOP_JOBstatement only terminates the currently running job instance and does not affect any future scheduled executions of the job. The job will continue to run as planned. - Failure count statistics for terminated jobs: Jobs terminated by
STOP_JOBorkill sessionwill be counted as one failure. If a job fails consecutively a certain number of times (such as 16 times), it may be marked as corrupted by the system. - Impact on job execution when queues are backed up: If the system tenant queue or Oracle tenant queue is backed up, it may affect the execution of the
STOP_JOBstatement. Queue backup can lead to resource shortages, which may delay or block the execution of theSTOP_JOBstatement.
Examples
Immediately terminate the job MYJOB.
BEGIN
DBMS_SCHEDULER.STOP_JOB(
JOB_NAME => 'MYJOB,
force => FALSE);
END;
