Link to home
Start Free TrialLog in
Avatar of luyan
luyan

asked on

How to force a job do not run on schedule?

How to force a job do not run on schedule?
Thanks!
Avatar of garysadler
garysadler
Flag of United States of America image

depending on whether you're using the old or new scheduler:

old:
exec dbms_job.broken(myjobnumber,TRUE);

new:
exec dbms_scheduler.disable('myjobname');
Avatar of luyan
luyan

ASKER

How to find job name? I would like to use the command:
exec dbms_scheduler.disable('myjobname');
select job_name,program_name,job_action,enabled from dba_scheduler_jobs;
Avatar of luyan

ASKER

I knew the job number, but not job_name. Which table or view has job number and job_name? Then I can get the right job_name, and can run exec dbms_scheduler.disable('myjobname')
The new scheduler does not use job numbers.  If the job does not appear in the dba_scheduler_jobs view, then you are using the old scheduler and can view the job in the dba_jobs view.  In that case you must use the dbms_job.broken method to halt job execution.
Avatar of luyan

ASKER

sqlplus / as sysdba
SQL> execute dbms_job.broken(333, true)
BEGIN dbms_job.broken(333, true); END;
*
ERROR at line 1:
ORA-01013: user requested cancel of current operation
ORA-06512: at "SYS.DBMS_IJOB", line 525
ORA-06512: at "SYS.DBMS_JOB", line 245
ORA-06512: at line 1

What's wrong?
Avatar of luyan

ASKER

Please ignore the previous one. Please take a look the following:
sqlplus / as sysdba
SQL> execute dbms_job.broken(333, true)
BEGIN dbms_job.broken(333, true); END;
*
ERROR at line 1:
ORA-23421: job number 333 is not a job in the job queue
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_IJOB", line 529
ORA-06512: at "SYS.DBMS_JOB", line 245
ORA-06512: at line 1
Job #333 is a job defined in system.  Why I couldn't use - execute dbms_job.broken(333, true)?

ASKER CERTIFIED SOLUTION
Avatar of Naveen Kumar
Naveen Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of luyan

ASKER

thanks for your help!