Advanced Scheduler Concepts - Oracle 10g

Many Scheduler capabilities enable database administrators to control more advanced aspects of scheduling. Typically, these topics are not as important for application developers.

This section discusses the following advanced topics:

  • Job Classes
  • Windows
  • Window Groups

Job Classes

A job class is a way of grouping jobs into larger entities, thus enabling you to prioritize access to the job slaves among those job classes. This means that you can, for example, make sure a CEO’s request will begin before a routine job. In addition to using job classes for resource allocation, you can also use them for setting job characteristics or behavior that must be the same for all the jobs in the class.

When defining job classes, you should try to classify jobs by functionality. Consider dividing jobs into groups that access similar data, such as marketing, production, sales, finance, and human resources.

Within a job class, you can:

  • Specify attributes at the class level. For example, you can specify the same policy for purging log entries of all payroll jobs.
  • Specify the order in which a job is started. You can assign priority values of 1-5 to individual jobs so that jobs with a higher relative priority start before jobs with a lower priority. If two jobs have the same assigned value, the first job enqueued takes precedence.
  • Ensure that a job is started only if there are no runnable jobs with a higher priority in that class. In the case of resource contention, this ensures that you do not have a less important job preventing the timely completion of a more important one.

Some of the restrictions to keep in mind are:

  • A job must be part of exactly one class. When a job is created, you must specify which class the job is part of. If you do not specify which class the job is part of, it automatically becomes part of the default class.
  • Dropping a class while there are still jobs in that class results in an error. You can force a class to be dropped even if there are still jobs that are members of that class, but all jobs referring to that class will automatically be disabled. In this case, the class for these jobs will be reset to the default system class. Jobs belonging to the dropped class that are already running will continue to run under class settings determined at the start of the job.

Windows

A window enables you to change resource allocation during a time period such as time of day or time of the sales year. You do this so you can control which groups of users have what level of priority. For example, you could control access to a printer so product managers have a lower priority than executives. A window is represented by an interval of time with a well-defined beginning and end, such as "from 12am-6am".

You can assign a priority with each window. If windows overlap, the window with the highest priority is chosen over other windows with lower priorities.

Windows

Windows

Overlapping Windows

You use windows to guarantee that resources will be available when you need them. Therefore, you should try to avoid having more than one window active at the same time to minimize the potential for resources going to a less important task. It is not an error, however, for windows to overlap.

Overlapping Windows

Overlapping Windows

There are three windows so some rules need to be assigned for choosing which window will take precedence. The order of precedence for windows is as follows:

  1. A high priority is chosen over a low priority. Oracle recommends that you choose low as the normal setting so you can guarantee resources for important high priority jobs.
  2. A window gets to finish before the Scheduler switches to another window.
  3. When a window finishes, the window with the highest percentage of its duration remaining is chosen.

If at the end of a window there is still overlap with one or more windows, the Scheduler tries to switch to the window that has the highest priority and then, if the windows have the same priorities, to the one with the highest percentage of its duration remaining.

Overlapping windows are handled differently based on whether they have the same priority or not. When two or more windows of the same priority overlap, Oracle continues to run the window that was already running. After this window finishes running, Oracle switches to the one that still has the highest percentage of its duration left.

When high and low priority windows overlap, the Scheduler switches to the high priority window if it is currently running a low priority window. Jobs currently running that had a schedule naming the low priority window may be stopped depending on the behavior you assigned when you created the job. In addition, whenever two windows overlap, an entry is written in the Scheduler log.

Window Groups

You can group jobs for ease of use. An example would be to combine weekends, times from 12AM to 7AM, and holidays into something called "downtime". This downtime window group offers you more control over when jobs are run. In this case, perhaps the data warehousing department would only want their queries run during this time when they might be assigned a high percentage of available resources. A window group is only to combine windows and is only for jobs that use a window as a schedule.

Example of Window Group

A typical example of a window group is to have windows for weeknight, weekend, and holidays. A window group could be for combining them.

  • window1: for weeknights
  • window2:for weekends
  • mywindowgroup(window1, window2): for a combination of weeknights and weekends

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

Oracle 10g Topics