Using the second query I can find the JOB id. But using the first one it's not present. Why?
select *
from dba_scheduler_jobs dj
WHERE dj.job_action LIKE '%Power%02%' AND dj.owner = 'SIUETL';
select *
FROM dba_jobs dj
WHERE dj.what LIKE '%Power%02%' AND dj.log_user = 'SIUETL';
That's because DBA_JOBS uses the old (deprecated) DBMS_JOB job scheduling system, whereas DBA_SCHEDULER_JOBS uses the new and shiny DBMS_SCHEDULER.
These two are completely independent.
Related
I have many jobs running in my database. There is into all_scheduler_job_run_details table job_name,req_start_date and status.how can I write query for, when last time worked each jobs what their status was?
select job_name ,staus,max(req_start_date) from all_scheduler_job_run_details where owner='ALI' group by job_name
this is my code
If you just want the most recent execution, and assuming the jobs are not running right now, you can probably get away with:
select job_name, state, last_start_date
from all_scheduler_jobs
where owner = 'ALI'
I have a job started by the scheduler which tracks its sub-steps in a JOB_LOG table. Since yesterday, 17 o'clock it stopped logging its activity. This could mean that the job encountered an error, or that it is really taking this long, but that is unlikely since the entire job with all sub-steps usually doesn't take more than 4 hours.
If I run exec DBMS_SCHEDULER.STOP_JOB ( job_name => 'RUN_JOB', force => true); it tells me there is no job running. Just to be sure, I did an exec dbms_scheduler.enable('RUN_JOB'); which did not give errors.
Looking at the job in SQL developer, I see the job is enabled and that is supposed to run every 15 minutes, but I don't see any output in the logging table indicating a new job has started.
How can I find out what the reason for the stopped logging and the non-running job is?
I could try to run the job by exec DBMS_SCHEDULER.RUN_JOB('RUN_JOB'); but that would only obscure the actual error (assuming it works).
How can I look at the internal state of the job scheduler for this job? I would be especially interested in how the scheduler treats jobs that are still running (So that it doesn't start them every 15 minutes unless completed).
The output of SELECT JOB_NAME, STATE FROM DBA_SCHEDULER_JOBS WHERE JOB_NAME like 'RUN_%'; is RUN_JOB SCHEDULED;
The job has RUN_COUNT and FAILURE_COUNT of 12.
More information: If I run select JOB_NAME, STATUS, ERROR#, ADDITIONAL_INFO, ACTUAL_START_DATE from ALL_SCHEDULER_JOB_RUN_DETAILS where JOB_NAME like 'RUN_%' order by ACTUAL_START_DATE DESC;
I get error messages about ORA-00001: unique constraint (RATOR_MONITORING.JOB_LOG_PK) violated. This probably means there is an issue with the sequence generating the primary keys.
I was able to locate the issue by calling:
select JOB_NAME, STATUS, ERROR#, ADDITIONAL_INFO, ACTUAL_START_DATE from ALL_SCHEDULER_JOB_RUN_DETAILS where JOB_NAME like 'RUN_%' order by ACTUAL_START_DATE DESC;
This was also helpful in seeing that the job was being run, but with errors:
SELECT * FROM DBA_SCHEDULER_JOBS WHERE JOB_NAME like 'RUN_%';
I have a job scheduler to run a chain daily but from USER_SCHEDULER_JOB_LOG it seems like operation: chain_start are still in running status while operation: chain_run shown completed. Why is that so?
Besides that, SELECT * FROM ALL_SCHEDULER_RUNNING_JOBS returns no rows.
What is wrong with the job that the chain_start did not complete?
Attached snippet from USER_SCHEDULER_JOB_LOG
Please, provide with output of the following queries:
SELECT * FROM ALL_SCHEDULER_JOBS WHERE OWNER NOT IN ('SYS');
and
SELECT * FROM ALL_SCHEDULER_JOB_RUN_DETAILS WHERE OWNER NOT IN ('SYS');
I'm running a procedure in parallel by using oracle's dbms parallel execute utility which chunks the workload ; but I have few chunks failing and I can't see any error logs. Is there a way to find out ?
Check this. The last two columns.
SELECT *
FROM user_parallel_execute_chunks
WHERE task_name = '{task name}'
ORDER BY chunk_id
/
I'm not sure, but probably you can use job_name from previous table. And query for more information from scheduler's tables. user_scheduler_job_run_details, user_scheduler_job_log.
Is it possible to search a JOB by the code it executes?
I.E. I want to find the JOB that launches a certain stored procedure.
Is there a query to do it?
select
*
from
user_jobs
where
what like '%my_token%';
Try using the all_dependencies view.
select * from all_dependencies where referenced_name = 'YOUR_STORED_PROC';