dbms_scheduler Create Job Not running Job

痞子三分冷 提交于 2021-02-07 19:53:12

问题


I am trying to run a procedure through a dbms_scheduler but it is just getting created but not running. DataBase Version Used Oracle 11.2.x

Procedure

create or replace procedure count_comp
as
Total_count number;
begin
select count(*) into Total_count from user_tables;
dbms_output.put_line('Number   '|| Total_count);
end;

Create Job

BEGIN
DBMS_SCHEDULER.CREATE_JOB (
        job_name => 'My_Count_Job',
        job_type => 'STORED_PROCEDURE',
        job_action => 'count_comp',
        start_date => '28-APR-08 07.00.00 PM Asia/Calcutta',
        repeat_interval => 'FREQ=DAILY;INTERVAL=2', /* every other day */
        auto_drop => FALSE,
        enabled =>TRUE,
        comments => 'My new job');
END;
/

回答1:


Some of the possible Reasons as mentioned below. job_queue_processes may be too low To check Execute below query select value from v$parameter where name='job_queue_processes';

Then check the number of running jobs

select count(*) from dba_scheduler_running_jobs;
select count(*) from dba_jobs_running;

If this is the problem you can increase the parameter using

alter system set job_queue_processes=1000;

2) max_job_slave_processes may be too low If this parameter is not NULL then it limits how many dbms_scheduler jobs can be running at a time. To check w

select value from dba_scheduler_global_attribute
where attribute_name='MAX_JOB_SLAVE_PROCESSES';

Then check the number of running jobs

select count(*) from dba_scheduler_running_jobs;

If this is the problem you can increase the number or just NULL it out using

exec dbms_scheduler.set_scheduler_attribute('max_job_slave_processes',null)

3) sessions may be too low

4) Check if the Scheduler been disabled

select value from dba_scheduler_global_attribute where attribute_name='SCHEDULER_DISABLED'

If this query returns TRUE then you can fix this using SQL> exec dbms_scheduler.set_scheduler_attribute('scheduler_disabled','false');




回答2:


SELECT JOB_NAME, STATE FROM DBA_SCHEDULER_JOBS WHERE JOB_NAME = 'partition_table_plapp2';

Above query will tell you status of your Job : ENABLED, DISABLED, SCHEDULED

select JOB_NAME, STATUS, ERROR#, ADDITIONAL_INFO from ALL_SCHEDULER_JOB_RUN_DETAILS where job_name = 'partition_table' ;

Above query will tell you what went wrong while running your job.

Once you find what is the issue with your job we can investigate further.

If you are using sqldeveloper (sql developer) to create and schedule DBMS_SCHEDULER (dbms scheduler) jobs, I would advice you go through this page : http://www.opencodez.com/oracle/oracle-job-scheduler-guide-examples-part-1.htm



来源:https://stackoverflow.com/questions/45844246/dbms-scheduler-create-job-not-running-job

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!