Quantcast
Channel: Oracle Database&EBS General – HELIOS BLOG
Viewing all articles
Browse latest Browse all 138

How to Stop / Drop Scheduled / Running jobs in Oracle

$
0
0

We create jobs and can schedule it by using DBMS_SCHEDULER package. We can also use this package for to stop or drop the job.

There are two separate procedure(stop_job and drop_job) exists in the package.

In some cases you will have to use the force option to stop the job.

Let start to example

Devamını oku: How to Stop / Drop Scheduled / Running jobs in Oracle


SQL> SELECT job_name, state FROM DBA_SCHEDULER_JOBS where job_name like ‘%HELIOS%’;

JOB_NAME STATE
———————– —————
HELOS_TEST_JOBS RUNNING

SQL> exec DBMS_SCHEDULER.stop_JOB (job_name => ‘DEMO.HELOS_TEST_JOBS’);
BEGIN DBMS_SCHEDULER.stop_JOB (job_name => ‘DEMO.HELOS_TEST_JOBS’); END;

*
ERROR at line 1:
ORA-27366: job “SYS”.”DEMO.HELOS_TEST_JOBS” is not running
ORA-06512: at “SYS.DBMS_ISCHED”, line 227
ORA-06512: at “SYS.DBMS_SCHEDULER”, line 674
ORA-06512: at line 1

SQL> SELECT job_name, state FROM DBA_SCHEDULER_JOBS where job_name like ‘%HELIOS%’;

JOB_NAME STATE
———————– —————
HELOS_TEST_JOBS RUNNING

So let us start to use force=True to stop the job forcefully.

SQL> exec DBMS_SCHEDULER.stop_JOB (job_name => ‘DEMO.HELOS_TEST_JOBS’,force=>true);

PL/SQL procedure successfully completed.

SQL> SELECT job_name, state FROM DBA_SCHEDULER_JOBS where job_name like ‘%HELIOS%’;
no rows selected

So let us drop the job

SQL> exec DBMS_SCHEDULER.drop_JOB (job_name => ‘DEMO.HELOS_TEST_JOBS’,force=>true);
PL/SQL procedure successfully completed.

SQL> SELECT job_name, state FROM DBA_SCHEDULER_JOBS where job_name like ‘%HELIOS%’;
no rows selected


Viewing all articles
Browse latest Browse all 138

Trending Articles