Tag Archives: dbms_job

ORA-23421: job number xxx is not a job in the job queue

How to Remove Jobs in Oracle with dbms_job

The Oracle job scheduler shows an error when trying to remove it.

SQL> exec dbms_job.remove(24);
BEGIN dbms_job.remove(24); END;
*
ERROR at line 1:
ORA-23421: job number 24 is not a job in the job queue
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_IJOB", line 770
ORA-06512: at "SYS.DBMS_JOB", line 180
ORA-06512: at line 1

Option 1
1) Find the Owner of the job from dbms_job table

select job, schema_user from dba_jobs;
JOB  Schema_User
---  -----------
24   HR

2) Log in as schema user and then remove the job.

Conn hr
Enter password:
connected.
select job,schema_user from user_jobs;
JOB Schema_User
--------- -----------
24 HR

exec dbms_job.remove(24);
PL/SQL procedure successfully completed.

Option 2
1) dbms_ijob : This Oracle package manages jobs for other users, overseeing those scheduled in DBA_JOBS.
SYS/SYSTEM users can use it to manage other users’ jobs.

SQL> exec dbms_ijob.remove(24);
PL/SQL procedure successfully completed.