Examples of Using the Scheduler - Oracle 10g

This section discusses the following topics:

  • Examples of Creating Jobs
  • Examples of Creating Job Classes
  • Examples of Creating Programs
  • Examples of Creating Windows
  • Examples of Setting Attributes
  • Examples of Creating Jobs

This section contains several examples of creating jobs.

Creating a Job

The following statement creates a job called my _job1 in the oe schema:

This job gathers table statistics on the sales table. It will run for the first time on July 15th and then once a day until September 15. To verify that the job was created, issue the following statement:

Example Creating a Job

The following statement creates a job called my_job2 in the SYSTEM schema:

Examples of Creating Job Classes

This section contains several examples of creating job classes.

Creating a Job Class

The following statement creates a job class:

This creates my_class1 in SYS. It uses a service called my_service1. To verify that the job class was created, issue the following statement:

Creating a Job Class

The following statement creates a job class:

This creates finance_jobs in SYS. It uses a resource consumer group called finance_group.

Examples of Creating Programs

This section contains several examples of creating programs.

Creating a Program

The following statement creates a program in the oe schema:

This creates my_program1, which uses PL/SQL to gather table statistics on the sales table. To verify that the program was created, issue the following statement:

Creating a Program

The following statement creates a program in the oe schema:

This creates my_saved_program1, which uses an executable.

Examples of Creating Windows

This section contains several examples of creating windows.

Creating a Window

The following statement creates a window called my_window1 in SYS:

This window will open once a day at 1AM for 80 minutes every day from May 15th to October 15th. To verify that the window was created, issue the following statement:

SELECT WINDOW_NAME FROM DBA_SCHEDULER_WINDOWS WHERE WINDOW_NAME = 'MY_WINDOW1';

Creating a Window

The following statement creates a window called my_window2 in SYS:

Example of Creating Window Groups

The following statement creates a window group called my _window _group1:

Then, you could add three windows (my _window1, my _window2, and my _window3) to my_window_group1 by issuing the following statements:

To verify that the window group was created and the windows added to it, issue the following statement:

Examples of Setting Attributes

This section contains several examples of setting attributes.

Setting the Frequency Attribute

The following example resets the frequency my _emp _job1 will run to daily:

To verify the change, issue the following statement:

Setting the Comments Attribute

The following example resets the comments for my_saved_program1:

To verify the change, issue the following statement:

Setting the Duration Attribute

The following example resets the duration of my _window3 to 90 minutes:

To verify the change, issue the following statement:

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Oracle 10g Topics