Friday, November 14, 2008

Disable a scheduler job

To disable a schedular job, if it is running, it may be necessary to stop it before it can be disabled.

Below is an exmaple that I did today for a production change request:
( changed the real database name)


BV_DATA@mydbname> select owner, job_name, state from dba_scheduler_jobs where job_name like 'ANYNAME_%';

OWNER JOB_NAME STATE
-------------------- ------------------------------ ---------------
BV_DATA ANYNAME_TAMQFL02ANK_CORR_JOB DISABLED
BV_DATA ANYNAME_MOBLAL02ANK_CORR_JOB DISABLED
BV_DATA ANYNAME_MOBLAL01ANK_CORR_JOB RUNNING
BV_DATA ANYNAME_LPTPPA01ANK_CORR_JOB DISABLED

4 rows selected.

BV_DATA@mydbname> exec dbms_scheduler.stop_job ('ANYNAME_MOBLAL01ANK_CORR_JOB');

PL/SQL procedure successfully completed.

BV_DATA@mydbname> exec dbms_scheduler.disable(user||'.ANYNAME_LPTPPA01ANK_CORR_JOB',true);

PL/SQL procedure successfully completed.

BV_DATA@mydbname> select owner, job_name, state from dba_scheduler_jobs where job_name like 'ANYNAME_%';

OWNER JOB_NAME STATE
-------------------- ------------------------------ ---------------
BV_DATA ANYNAME_TAMQFL02ANK_CORR_JOB DISABLED
BV_DATA ANYNAME_MOBLAL02ANK_CORR_JOB DISABLED
BV_DATA ANYNAME_MOBLAL01ANK_CORR_JOB DISABLED
BV_DATA ANYNAME_LPTPPA01ANK_CORR_JOB DISABLED



No comments: