0

I have created a job in Oracle using following scheduler -

BEGIN
  DBMS_SCHEDULER.create_job (
    job_name        => 'MY_JOB',
    job_type        => 'PLSQL_BLOCK',
    job_action      => 'BEGIN my_pkg.pull_data(''Y''); END;',
    start_date      => '31-AUG-21 07.00.00 PM America/New_York',
    repeat_interval => 'freq=daily; byminute=0; bysecond=0;',
    enabled         => TRUE);
END;
/

When I am running job manually using below code -

BEGIN
  DBMS_SCHEDULER.RUN_JOB(
    JOB_NAME            => 'MY_JOB',
    USE_CURRENT_SESSION => FALSE);
END;

The job is running as expected. However, scheduled same jobs are failed again and again with below error.

ORA-01031: insufficient privileges ORA-06512: at "SCOTT.MY_PKG", line 246 ORA-06512: at line 1

Any suggestion, what I am doing wrong? I think I have sufficient privileges. Edit - If I call, individual procedure which is used in the job, it's working as expected. I have checked the line 246, which is a select statement from a table in the same schema as job, proc and other tables used by the proc.

BEGIN my_pkg.pull_data('Y'); END;
Sid
  • 582
  • 3
  • 7
  • 28
  • Check line 246 of `MY_PKG`. Whatever your program is having problems with is there. – pmdba Sep 12 '21 at 04:11
  • Thanks @pmdba. I already have checked it. It's a select statement from a table in the same schema. Moreover, if I run the job manually as I mentioned in my question, it doesn't throw any error. – Sid Sep 12 '21 at 05:06
  • 1
    With the manual job run (which works) what happens if you run it after issuing "set role none" – Connor McDonald Sep 13 '21 at 01:30

0 Answers0