Oracle:如何从 PL/SQL 使作业脱机?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11098610/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 00:54:30  来源:igfitidea点击:

Oracle: how do I take a Job offline from PL/SQL?

oraclejobsdbms-job

提问by Revious

I need to look for a JOB by thw WHAT column. Check if it is actually running. If not take it offline and put online again to make it start immediately.

我需要通过 WHAT 列寻找工作。检查它是否真的在运行。如果没有将其离线并重新上线以使其立即启动。

采纳答案by Justin Cave

Assuming based on the column names you referenced that you are using the DBMS_JOBpackage to schedule your jobs rather than the newer and more sophisticated DBMS_SCHEDULER, it's not obvious to me that you really need to take the job offline. If you want to force it to run immediately,

假设根据您引用的列名称,您正在使用该DBMS_JOB包来安排您的作业,而不是更新和更复杂的DBMS_SCHEDULER,那么我认为您确实需要离线作业并不明显。如果你想强制它立即运行,

dbms_job.run( <<job number>> );

If you really do want to take the job offline, you can break it

如果你真的想离线工作,你可以打破它

dbms_job.broken( <<job number>>, true );
commit;

and then you can unbreak it

然后你就可以解开它

dbms_job.broken( <<job number>>, false );
commit;

You can determine whether the job is currently running by querying the DBA_JOBS_RUNNINGview

您可以通过查询DBA_JOBS_RUNNING视图来确定作业当前是否正在运行

SELECT count(*)
  FROM dba_jobs_running
 WHERE job = <<job number>>

回答by Nikhil Reddy

If you are using Toad go to schema browser and look for jobs. rt clk on the job and make it offline and then commit it. This is the easy way if you don't remember commands.

如果您使用 Toad,请转到架构浏览器并寻找工作。rt clk 工作并使其脱机,然后提交。如果您不记得命令,这是一种简单的方法。