Forcing Windows Open and Closed
Let’s suppose that you have defined a window for regular OLTP activities named OLTP_WINDOW, starting at 9:00 A.M. Today, uncharacteristically, the processing started early—perhaps at 7:00 A.M. You have defined the resource manager group associated with the window, and you want this job to be under the resource plan, if possible. But the window is not scheduled to be open until two hours from now. What can you do?
In a case like this, you can force a window to open, using the procedure OPEN_WINDOW, as shown here:
BEGIN
DBMS_SCHEDULER.open_window (
window_name => 'OLTP_WINDOW', DURATION => NULL);
END;This immediately opens the specified window, and any jobs using this window can immediately use the resource plan.
In this example, the duration parameter is specified as NULL, which means that the normal duration of the window will be followed. Suppose the normal duration, specified when the window was created, is eight hours, ending at 5:00 P.M. Because the window was manually opened at 7:00 A.M., it will automatically close eight hours after that, at 3:00 P.M. That may not be acceptable to you: you may want to keep the window open until 5:00 P.M. anyway. In that case, you can open the window with a specified duration, as shown below; the duration must be in the INTERVAL datatype .
BEGIN
dbms_scheduler.open_window (
window_name => 'OLTP_WINDOW',
DURATION => NUMTODSINTERVAL (600, 'minute')
);
END;