The STOP_JOB procedure stops a running job.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Required privileges
You can execute the STOP_JOB procedure in the sys tenant to stop an ongoing job of other user tenants, or execute the procedure in a user tenant to stop a running job of the current tenant.
Syntax
DBMS_SCHEDULER.STOP_JOB (
job_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE);
Parameters
| Parameter | Description |
|---|---|
| job_name | The name of the job. You can specify only one job name. |
| force | Specifies whether to forcibly stop a running job. You can set the value only to FALSE, which specifies not to forcibly stop a running job. |
Considerations
- Stopping of multiple running rounds of a job: The
STOP_JOBprocedure stops all instances of the job that are started before the point in time when the procedure is executed, as well as the corresponding sessions. - Impact on future scheduling:
STOP_JOBstops ongoing job instances and does not affect the future scheduling of the job. A job stopped by the procedure will still be executed as scheduled. - Count of failures for a stopped job: If a job is stopped by the
STOP_JOBprocedure or thekill sessioncommand, the count of failures increases by 1. When the count of consecutive failures of a job reaches a specified number, such as 16, the job may be considered damaged by the system. - Impact of an accumulated queue: An accumulated queue in the
systenant or an Oracle tenant may delay or hinder the execution of theSTOP_JOBprocedure due to insufficient resources.
Examples
Stop the MYJOB job immediately.
BEGIN
DBMS_SCHEDULER.STOP_JOB(
JOB_NAME => 'MYJOB,
force => FALSE);
END;