oracle dbms_scheduler.run_job('jobName) 无法运行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7188626/
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-10 03:29:33  来源:igfitidea点击:

dbms_scheduler.run_job('jobName) fails to run

oraclestored-proceduresplsqldbms-scheduler

提问by Manoj

I'm trying to run a scheduled job manually, the job looksa like this

我正在尝试手动运行计划作业,该作业看起来像这样

  DBMS_SCHEDULER.CREATE_JOB (
   job_name           =>  'UPDATE_PLAYER_STATES',
   job_type           =>  'STORED_PROCEDURE',
   job_action         =>  'PLAYER_STATE_UPDATER',
   repeat_interval    =>  'FREQ=DAILY;BYHOUR=0', /* every day at Midnight */
   job_class          =>  'DEFAULT_JOB_CLASS',
   enabled            =>  true,
   auto_drop          =>  false);

Now when I run the procedure using execute PLAYER_STATE_UPDATERI can see the desired result , but the job is failing to execute as shown by

现在,当我使用运行该程序时,execute PLAYER_STATE_UPDATER我可以看到所需的结果,但该作业无法执行,如图所示

select log_date, job_name, status, run_duration
from dba_scheduler_job_run_details where job_name='UPDATE_PLAYER_STATES' or status='FAILED';


    LOG_DATE                    JOB_NAME        STATUS   RUN_DURATION 
------------- -----------------------------------------------------------------
23-AUG-11 00.20.24.288887000 +01:00 UPDATE_PLAYER_STATES    FAILED    0 0:0:0.0    
22-AUG-11 10.27.24.537659000 +01:00 UPDATE_PLAYER_STATES    FAILED    0 0:0:0.0    
22-AUG-11 10.28.50.447042000 +01:00 UPDATE_PLAYER_STATES    FAILED    0 0:0:0.0    
22-AUG-11 10.30.30.018891000 +01:00 UPDATE_PLAYER_STATES    FAILED    0 0:0:0.0    
25-AUG-11 10.59.02.332579000 +01:00 UPDATE_PLAYER_STATES    FAILED    0 0:0:0.0    
25-AUG-11 10.59.15.980730000 +01:00 UPDATE_PLAYER_STATES    FAILED    0 0:0:0.0    
25-AUG-11 10.59.27.823131000 +01:00 UPDATE_PLAYER_STATES    FAILED    0 0:0:0.0    
25-AUG-11 11.01.04.798364000 +01:00 UPDATE_PLAYER_STATES    FAILED    0 0:0:0.0    
24-AUG-11 00.20.24.419251000 +01:00 UPDATE_PLAYER_STATES    FAILED    0 0:0:0.0    
25-AUG-11 00.20.24.299180000 +01:00 UPDATE_PLAYER_STATES    FAILED    0 0:0:0.0    
25-AUG-11 09.35.24.798535000 +01:00 UPDATE_PLAYER_STATES    FAILED    0 0:0:0.0    

And executing the job manually is failing too dbms_scheduler.run_job('UPDATE_PLAYER_STATES');with the error

并且手动执行作业也dbms_scheduler.run_job('UPDATE_PLAYER_STATES');因错误而失败

Error starting at line 1 in command:
dbms_scheduler.run_job('UPDATE_PLAYER_STATES')
Error report:
Unknown Command

What am I missing.

我错过了什么。

回答by Dave Costa

When you're trying to run the job manually, it looks like you are simply not using the correct syntax in SQL Developer. You need to use execute dbms_scheduler.run_job('UPDATE_PLAYER_STATES'). Of course that doesn't explain why the job is failing.

当您尝试手动运行作业时,您似乎没有在 SQL Developer 中使用正确的语法。您需要使用execute dbms_scheduler.run_job('UPDATE_PLAYER_STATES'). 当然,这并不能解释为什么工作失败。

My guess is there's something wrong with the job configuration such that it can't even start; but I don't see what it is. You might try including the schema name in the job_actionto make sure it is not looking in the wrong schema.

我的猜测是作业配置有问题,以至于它甚至无法启动;但我不明白它是什么。您可以尝试在 中包含架构名称job_action以确保它没有在错误的架构中查找。

Is there anything of interest in the other columns of dba_scheduler_job_run_details-- particularly error#or additional_info?

在其他栏目中是否有任何感兴趣的东西dba_scheduler_job_run_details——特别是error#additional_info

回答by Ramiro Juarez

you're running manually the JOB as:

您正在手动运行 JOB:

dbms_scheduler.run_job('UPDATE_PLAYER_STATES')

Oracle think this is a command, but is not, that's why you receive error message, "Unknown command".

Oracle 认为这是一个命令,但实际上不是,这就是您收到错误消息“未知命令”的原因。

The correct wayto execute it is:

正确的方法来执行它是:

BEGIN
   dbms_scheduler.run_job('UPDATE_PLAYER_STATES');
END;

Once you achieved to execute it, if your schema do not have enough privileges, then you will see something like "Object do not exist or you don't have permissions", which is probably the root cause of the issue.

一旦你成功执行它,如果你的架构没有足够的权限,那么你会看到类似“对象不存在或你没有权限”之类的东西,这可能是问题的根本原因

Best Regards :)

此致 :)