11g scheduling -- use scheduler

Source: Internet
Author: User

11g scheduling -- scheduler use CREATE_SCHEDULE Procedure www.2cto.com This procedure creates a schedule. DBMS_SCHEDULER.CREATE_SCHEDULE (schedule_name IN VARCHAR2, start_date in timestamp with timezone default null, repeat_interval IN VARCHAR2, end_date in timestamp with timezone default null, comments IN VARCHAR2 default null ); schedule_nameThe name to assign to the schedule. the name must be unique in the SQ L namespace. For example, a schedule cannot have the same name as a table in a schema. If no name is specified, then an error occurs. the name is unique and must be specified !! Start_dateThis attribute specifies the first date and time on which this schedule becomes valid. for a repeating schedule, the value for start_date is a reference date. in this case, the start of the schedule is not the start_date; it depends on the repeat interval specified. start_date is used to determine the first instance of the schedule. if start_date is specified in the past and no value for r Epeat_interval is specified, the schedule is invalid. for a repeating job or window, start_date can be derived from the repeat_interval if it is not specified. if start_date is null, then the date that the job or window is enabled is used. start_date and repeat_interval cannot both be null. this parameter specifies when to start schedule. The time for repetition depends on the schedulerepeat_intervalThis attribute specifies how often the schedule repeats. it is expressed using calendaring syntax. see "Calendaring Syntax" for further information. PL/SQL expressions are not allowed as repeat intervals for named schedules. this parameter determines the schedule execution cycle usage. The end_dateThe date and time after which jobs will not run and windows will not open are listed below. A non-repeating schedule That has no end_date is valid forever. end_date has to be after the start_date. if this is not the case, then an error is generated when the schedule is created. commentsThis attribute specifies an optional comment about the schedule. by default, this attribute is NULL. note: permission issues This procedure requires the create job privilege to create a schedule in your own schema or the create any job privilege to c Reate a schedule in someone else's schema by specifying schema. schedule_name. once a schedule has been created, it can be used by other users. the schedule is created with access to PUBLIC. therefore, there is no need to explicitly grant access to the schedule. repeat_interval: Usage: for example, set the task to run only on week 5: REPEAT_INTERVAL => 'freq = DAILY; BYDAY = fri'; REPEAT_INTERVAL => 'freq = WEEKLY; BYDAY = fri'; REPEAT_INTERVAL => 'Freq = YEARLY; BYDAY = fri'; although the specified keywords are small, the above three statements have the same functions. Set the task to run once every week and only run on the fifth day of the week: REPEAT_INTERVAL => 'freq = WEEKLY; INTERVAL = 2; BYDAY = fri'; set the task to run on the last day of the month: REPEAT_INTERVAL => 'freq = MONTHLY; BYMONTHDAY =-1'; set the task to run on April 9, March 10: REPEAT_INTERVAL => 'freq = YEARLY; BYMONTH = MAR; BYMONTHDAY = 10 '; REPEAT_INTERVAL => 'freq = YEARLY; BYDATE = 100'; the functions of the preceding two statements are the same. Set the task to run every 10 days: REPEAT_INTERVAL => 'freq = DAILY; INTERVAL = 10'; set the task to run at 4, 5, or 6 o'clock every day: REPEAT_INTERVAL => 'freq = DAILY; BYHOUR = 16, 17, 18'; set the task to run on the 29th day of every month: REPEAT_INTERVAL => 'freq = MONTHLY; BYMONTHDAY = 29 '; set the task to run in the last week of each year: REPEAT_INTERVAL => 'freq = YEARLY; BYDAY =-1fri'; set the task to run every 50 hours: REPEAT_INTERVAL => 'freq = HOURLY; INTERVAL = 50 ';

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.