How to stop a job scheduled in DBMS_SCHEDULER?

Using sys.dbms_scheduler.STOP_JOB one can stop scheduled job. SQL> exec sys.dbms_scheduler.STOP_JOB(job_name=>'SYS.ORA$AT_OS_OPT_SY_12856', force=>true); Output: PL/SQL procedure successfully completed. If it can’t find the job then you may see the following error, in the example below I hadn’t specified the user to it was looking for the job as the current user. ORA-27475: “DBAUSER.ORA$AT_OS_OPT_SY_12856” must be a job…

dba_jobs and interval

Few examples of some scenarios of setting intervals for dba_jobs. Note: Updating the interval will not update the NEXT_DATE run of the job until the job runs. Setting a job to run every monday at 10:00 am SQL> exec dbms_job.interval(5, 'TRUNC(NEXT_DAY(SYSDATE, ''MONDAY''))+(10/24)'); SQL> commit; — assume job was run and this SQL was run after…

Using sys.dbms_iob one can manage jobs in dba_jobs.

DBMS_JOB allows one to create/manage jobs under user who has logged but using sys.dbms_ijob one can manage jobs all jobs scheduled in DBA_JOBS. Here are some of the functions available in sys.dbms_ijob. To execute/run job: You don’t have to be an owner of the job SQL> exec sys.dbms_ijob.run(5); If one tried executing the job not…

How to tell/find if the instance is Primary/Standby?

By querying v$database one can tell if the host is primary or standby For primary testdb> select database_role from v$database; DATABASE_ROLE —————- PRIMARY For Standby – Note you may need to connect to as sys as sysdba if the instance is in mount state testd> select database_role from v$database; DATABASE_ROLE —————- PHYSICAL STANDBY OR On…

Dataguard ORA-16817

If you have an issue where the server where standby resides had to be restarted and when you try to enable Fast Start Failover, it wouldn’t enable due to ORA-16608 and when checking the primary database in dataguard it would return ORA-16817 “unsynchronized fast-start failover configuration” Example: $ dgmgrl / DGMGRL> enable configuration Enabled. DGMGRL>…

How to suspend all jobs from executing in dba_jobs?

By setting the value of 0 to the parameter “job_queue_processes” one can suspend all jobs from executing in DBA_JOBS. The value of this parameter can be changed without instance restart. -- see current value of the parameter SQL> show parameter job_queue_processes; NAME TYPE VALUE ———————————— ———– ———– job_queue_processes integer 1000 -- Set the value of…

How to see the jobs currently being executed?

Using dba_jobs_running it will show the all jobs executing. SQL> select djr.sid, djr.job, djr.failures, djr.this_date, djr.this_sec, dj.what from dba_jobs_running djr, dba_jobs dj where djr.job = dj.job; SID JOB FAILURES THIS_DATE THIS_SEC ———- ———- ———- ——————– ——– WHAT —————————————————————————————————- 68 21 0 19-feb-2012 21:09:34 21:09:34 dbms_lock.sleep(100);