Windows define the times when resource plans are
active.
Since job classes point to resource
consumer groups, and therefore resource plans,
this mechanism allows control over the resources
allocated to job classes and their associated
jobs during specific time periods.
A window can be assigned to the
schedule_name
parameter
of a job instead of a schedule object.
Only one window can be active at any time with
one resource plan assigned to the window.
The effects of resource plan switches are
instantly visible to running jobs that are
assigned to job classes.
A window can be created using the
create_window
procedure with a predefined or inline schedule.
PROCEDURE create_window (
window_name
IN VARCHAR2,
resource_plan
IN VARCHAR2,
schedule_name
IN VARCHAR2,
duration
IN INTERVAL DAY TO SECOND,
window_priority
IN VARCHAR2
DEFAULT 'LOW',
comments
IN VARCHAR2
DEFAULT NULL)
PROCEDURE create_window (
window_name
IN VARCHAR2,
resource_plan
IN VARCHAR2,
start_date
IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
repeat_interval
IN VARCHAR2,
end_date
IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
duration
IN INTERVAL DAY TO SECOND,
window_priority
IN VARCHAR2
DEFAULT 'LOW',
comments
IN VARCHAR2
DEFAULT NULL)
The parameters associated with these procedures
and their usage are as follows:
-
window_name
- A
name that uniquely identifies the window
-
resource_plan
- The resource plan associated with the
window.
When the window opens, the system
switches to use the associated resource
plan.
When the window closes, the system
switches back to the previous resource plan.
-
schedule_name
- The name of the schedule associated with
the window.
If this is specified, the
start_date,
repeat_interval
and
end_date
must be NULL.
-
start_date
- The date when this window will take
effect.
This may be in the future if the
window is to be set up in advance.
-
repeat_interval
- The definition of how often the window
should open.
A value of NULL indicates that the
window should only open once.
-
end_date
- The date when this window will stop.
This, combined with the
start_date parameter, enables
a window to be scheduled for a finite period
of time.
-
duration
- The length of time in minutes the window
should remain open
-
window_priority
- The priority (LOW or HIGH) of the window.
In the event of multiple windows
opening at the same time, windows with a
high priority take precedence over windows
with a low priority, which is the default.
-
comments
- Free text that allows the user to record
additional information
The following code shows how the
create_window
procedures can be used:
BEGIN
-- Window with a predefined schedule.
DBMS_SCHEDULER.create_window (
window_name
=> 'test_window_1',
resource_plan
=> NULL,
schedule_name
=> 'TEST_HOURLY_SCHEDULE',
duration
=> INTERVAL '30' MINUTE,
window_priority => 'LOW',
comments
=> 'Window with a predefined
schedule.');
END;
/
BEGIN
-- Window with an inline schedule.
DBMS_SCHEDULER.create_window (
window_name
=> 'test_window_2',
resource_plan
=> NULL,
start_date
=> SYSTIMESTAMP,
repeat_interval => 'freq=hourly;
byminute=0',
end_date
=> NULL,
duration
=> INTERVAL '30' MINUTE,
window_priority => 'LOW',
comments
=> 'Window with an inline
schedule.');
END;
/
The SYS user is the owner of all windows, so any
schedules referenced by them must also be owned
by SYS.
Figure 11.23 shows the Create Window screen in
the OEM DB Control.
Figure 11.23 –
OEM DB Control: Create Window