The ENABLE procedure is used to enable jobs and programs.
When an object is enabled, its enabled attribute is set to TRUE. By default, newly created jobs and programs are disabled.
If a job is disabled and then enabled again, the Scheduler will start running the job according to its schedule.
Validity checks are performed before enabling an object. If the check fails, the object cannot be enabled, and an error message is returned. If the object is successfully enabled, no error message is returned.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
DBMS_SCHEDULER.ENABLE (
job_name IN VARCHAR2);
Parameters
| Parameter | Description |
|---|---|
| job_name | The name of the Scheduler object to be enabled. The name can be a comma-separated list. If a job class name is specified, all jobs in that class will be enabled. The system-defined scheduled jobs are as follows:
|
Considerations
You can use the
ENABLEprocedure for any schema except theSYSschema.To enable the
SCHEDULED_TRIGGER_PARTITION_BALANCEtask, the tenant-level parameter partition_balance_schedule_interval must be set to 0. Otherwise, an errorOB_OP_NOT_ALLOWwill be returned. The parameter trigger and the scheduled task trigger cannot be enabled at the same time.To enable the
DAILY_MAINTENANCE_WINDOWtask, the tenant-level parameter enable_window_compaction must be set toTrue. Otherwise, an error will be returned.
Examples
Enable the program named
job_test.obclient(SYS@oracle001)[SYS]> delimiter //obclient(SYS@oracle001)[SYS]> BEGIN DBMS_SCHEDULER.ENABLE(job_name => 'job_test'); END;//obclient(SYS@oracle001)[SYS]> delimiter ;Enable the scheduled partition balancing task.
obclient(SYS@oracle001)[SYS]> CALL DBMS_SCHEDULER.ENABLE(job_name => 'SCHEDULED_TRIGGER_PARTITION_BALANCE');or
obclient(SYS@oracle001)[SYS]> CALL DBMS_SCHEDULER.ENABLE('SCHEDULED_TRIGGER_PARTITION_BALANCE');Enable the window compaction task.
obclient(SYS@oracle001)[SYS]> CALL DBMS_SCHEDULER.ENABLE(job_name => 'DAILY_MAINTENANCE_WINDOW');or
obclient(SYS@oracle001)[SYS]> CALL DBMS_SCHEDULER.ENABLE('DAILY_MAINTENANCE_WINDOW');
