I submit a job by doing this:
VARIABLE jobno number;
BEGIN
DBMS_JOB.SUBMIT(:jobno,
'DBMS_STATS.GATHER_DATABASE_STATS;',
sysdate, 'SYSDATE + 1',
TRUE, 1, FALSE);
commit;
END;
/
Now, I am getting this:
ORA-12012: error on auto execute of job 22
ORA-20000: Insufficient privileges to analyze an object in Database
ORA-06512: at "SYS.DBMS_STATS", line 4621
ORA-06512: at "SYS.DBMS_STATS", line 4756
ORA-06512: at "SYS.DBMS_STATS", line 4741
Please note: I am logging in as a user with dba role. I can run "exec 'DBMS_STATS.GATHER_DATABASE_STATS;" without any problem. Why cannot I run it in a job?