Applies to:
Oracle Server - Enterprise Edition - Version 10.1.0.2 and laterGoal
Is it possible to disable the Scheduler, for maintenance work by executing the following statement:
我们是否能通过下面的DBMS包来禁用scheduler_job?
DBMS_SCHEDULER.set_scheduler_attribute('SCHEDULER_DISABLED', 'TRUE');
as after running the above command, the jobs are still running at the planned time.
执行了上面的DBMS包,scheduler_job依旧在计划的时间运行..
Fix--修复
It is not possible to disable the scheduler in version 10.2
在10.2上停止scheduler是不可能的
This has been added as a new feature starting Oracle 11gR2.
在11gR2才能停止
Oracle documentation allows us to use the dbms_scheduler.set_scheduler_attribute procedure only for these following attributes: default_timezone, max_job_slave_processes, and log_history.
Please refer to the Oracle® Database PL/SQL Packages and Types Reference.
ORACLE 文档告诉我们,dbms_scheduler.set_scheduler_attribute包只能用于default_timezone, max_job_slave_processes, and log_history,请参阅Oracle®数据库PL / SQL软件包和类型参考。
The SCHEDULER_DISABLED is unsupported for this package. This is not guaranteed to work, so we can not predict an expected behavior.
In some cases it might work if you allow the coordinator and slaves to exit after using SCHEDULER_DISABLED.
If dbms_scheduler.run_job is executed the job will still run.
From 11gR2 and above:
Starting from this version, by setting job_queue_processes to 0 all job processes are stopped, which means that DBMS_SCHEDULER jobs, autotask jobs and DBMS_JOB jobs cannot run.
从11.2以后,设置job_queue_processes=0,所有的job都将被禁用,这意味着DBMS_SCHEDULER,autotask,和DBMS_JOB都不会被运行
When using previous versions only DBMS_JOB jobs were disabled after changing job_queue_processes to 0.
Hence, in order to stop the scheduler jobs in 11gR2 and above, setting the parameter job_queue_processes to 0 is enough.