Oracle Windows
Published by : Obay Salah , November 19, 2024
We previously discussed the concept of Schedules, which are used to specify the time for executing Jobs. The concept of Windows is fundamentally based on this meaning to determine the timing of executing Jobs, while providing greater flexibility for Oracle to decide when execution occurs.
The new aspect of the Windows concept is that it prepares the Oracle for executing Jobs by enabling the Resource Manager Plan through which the Jobs will be executed. Thus, at the moment the Window opens, Oracle configures according to the variables of the Window, determining the duration for which the Window remains open, as well as the time to reopen the Window and the time to end the Window's operations.
Notice that the parameters of the procedure resemble those of CREATE_SCHEDULE to a large extent:
- WINDOW_NAME: The window name shares the same namespace as the Schedule, meaning a Window cannot be named the same as an existing Schedule in the same Schema.
- RESOURCE_PLAN: To designate the Resource Manager Plan that will be activated at the moment the Window opens.
- START_DATE: To specify the opening time of the Window.
- REPEAT_INTERVAL: To reopen the Window at another time.
- END_DATE: When the operations of the Window will conclude.
- DURATION: How long will the Window remain open, determined by specifying the day, hour, minute, and second.
- WINDOW_PRIORITY: To determine the priority of opening Windows, allowing only one Window to open at the same moment. The Window with the highest priority will open first.
This parameter can take two values: LOW (the default value) and HIGH. If more than one Window has the same priority, the Window that opens first will take precedence.
begin dbms_scheduler.create_window( window_name=>'dialy_window', resource_plan=>'system_plan', start_date=>sysdate, repeat_interval=>'freq=daily;interval=1', end_date=>sysdate+30, duration=>'0 00:10:00', window_priority=>'low'); end;
Now we can use this Window at the moment of creating the Job, but if we review the procedures for creating a Job (CREATE_JOB), they do not contain any reference to Windows.
This is true, but as I mentioned earlier, the Schedule shares the same namespace as the Window, which allows us to reference the Window through the Schedule_name variable.
There is another procedure that creates the Window, called CREATE_WINDOW, but this procedure depends on the existence of a ready Schedule, meaning we do not specify (START_DATE, REPEAT_INTERVAL, & END_DATE) ourselves; instead, we utilize an existing Schedule.
The database administrator can enable or disable the Window using the procedures (ENABLE & DISABLE).
begin dbms_scheduler.disable('DIALY_WINDOW'); dbms_scheduler.enable'DIALY_WINDOW'); end;
The database administrator can query the existing Windows in the database using the query DBA_SCHEDULER_WINDOWS
.
As for deleting a Window, this can be done using the procedure DROP_WINDOW
.
begin dbms_scheduler.disable('DIALY_WINDOW'); end;
Comments
no comment yet!