Oracle Job Scheduler Guide With Examples – Part 3

This is the last article in our 3 article series we have written on Oracle Job Scheduler. In this article, we will see the oracle job scheduling example that will tell us how we can schedule a windows executable batch file.

Guide Index

  1. Oracle Job Scheduler Guide With Examples – Part I
  2. Oracle Job Scheduler Guide With Examples – Part II
  3. Oracle Job Scheduler Guide With Examples – Part III

Schedule an Executable (Batch file)

As mentioned earlier we can schedule an external executable file using the oracle scheduler. We have a simple java program that generates files. We have written a batch wrapper for that and we will schedule this batch file as one of our steps in the chain.

This is code we have in run-java-program.bat

We will add one program RUNJAVA as Oracle Job Scheduler

Create one chain JAVATEST and add a single step as

Add start and end rule as shown below.


As we have only one step, once you are done our oracle job scheduler example will look like this in SQL Developer.

Now schedule a job running every 30 seconds as

Important Note

If a job or chain is running an external program, we need to make sure that Oracle Schedule Service is up and running. If it’s down you will get errors in the execution of job or chain.

In the below screen its disabled by default. Before you schedule, make sure the below service is running.Scheduling Job

Once the scheduling job is done, it will start running and files will start getting created as per your java file and batch file configuration. Below is the sample output.Job Scheduling

Simple, right? I bet you won’t find this simple oracle scheduler job example anywhere else 🙂

Below I have listed some of the PL/SQL blocks or commands that will help you to drop Job, Program, Chain, etc.

Drop Job

Drop Program

Drop Chain 

Drop Chain Step

Drop Chain Rule

Before we close our article let me share the tables we have used for our illustrations in the entire series.

You can use the below query to get some details on the Jobs we have scheduled in the oracle schema

That’s it. I guess we are good to conclude our 3 article series on Oracle Job Scheduler. Please feel free to get back to us if you have any queries.

You can refer to the Oracle package and tables scripts from our Git repository.

Download from Git

You may also be interested in our basic SQL Tutorials from scratch : 

https://www.opencodez.com/software-testing/sql-for-qa-tutorial-select-query.htm

7 Comments
  1. praveen D
    October 3, 2019 | Reply
  2. hin
    June 5, 2019 | Reply
    • Shilpa
      June 6, 2019 | Reply
  3. Bhupinder Singh
    November 16, 2018 | Reply
    • Pavan
      November 18, 2018 | Reply
  4. Galih
    November 7, 2018 | Reply
    • Pavan
      November 9, 2018 | Reply

Add a Comment

Your email address will not be published. Required fields are marked *