In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
How to set the Repeat Interval parameter, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, people who have this need can learn, I hope you can gain something.
Set Repeat Interval
The REPEAT_INTERVAL parameter in Job and Schedule is used to control the frequency or cycle of execution. Although the cycle is a temporal concept, the time specified by REPEAT_INTERVAL is not a time value, but a time described by a group of keywords.
In addition to the REPEAT_INTERVAL parameter of Job and Schedule described above, it is mentioned that this parameter has two keywords, FREQ and INTERVAL. In fact, in addition to this, there are parameters such as BYMONTH, BYWEEKNO, BYYEARDAY, BYDATE, etc., which can be used for more precise definition. For example, BYMONTH keyword specifies the month in which the schedule runs, BYDAY specifies the day on which the schedule runs, etc.
The detailed syntax for the REPEAT_INTERVAL parameter is as follows:
repeat_interval = regular_schedule | combined_schedule
==============================
regular_schedule = frequency_clause
[";" interval_clause] [";" bymonth_clause] [";" byweekno_clause]
[";" byyearday_clause] [";" bydate_clause] [";" bymonthday_clause]
[";" byday_clause] [";" byhour_clause] [";" byminute_clause]
[";" bysecond_clause] [";" bysetpos_clause] [";" include_clause]
[";" exclude_clause] [";" intersect_clause][";" periods_clause]
[";" byperiod_clause]
==============================
combined_schedule = schedule_list [";" include_clause]
[";" exclude_clause] [";" intersect_clause]
frequency_clause = "FREQ" "=" ( predefined_frequency | user_defined_frequency )
predefined_frequency = "YEARLY" | "MONTHLY" | "WEEKLY" | "DAILY" |
"HOURLY" | "MINUTELY" | "SECONDLY"
user_defined_frequency = named_schedule
==============================
interval_clause = "INTERVAL" "=" intervalnum
intervalnum = 1 through 99
bymonth_clause = "BYMONTH" "=" monthlist
monthlist = monthday ( "," monthday)*
month = numeric_month | char_month
numeric_month = 1 | 2 | 3 ... 12
char_month = "JAN" | "FEB" | "MAR" | "APR" | "MAY" | "JUN" |
"JUL" | "AUG" | "SEP" | "OCT" | "NOV" | "DEC"
byweekno_clause = "BYWEEKNO" "=" weeknumber_list
weeknumber_list = weeknumber ( "," weeknumber)*
weeknumber = [minus] weekno
weekno = 1 through 53
byyearday_clause = "BYYEARDAY" "=" yearday_list
yearday_list = yearday ( "," yearday)*
yearday = [minus] yeardaynum
yeardaynum = 1 through 366
bydate_clause = "BYDATE" "=" date_list
date_list = date ( "," date)*
date = [YYYY]MMDD [ offset | span ]
bymonthday_clause = "BYMONTHDAY" "=" monthday_list
monthday_list = monthday ( "," monthday)*
monthday = [minus] monthdaynum
monthdaynum = 1 through 31
byday_clause = "BYDAY" "=" byday_list
byday_list = byday ( "," byday)*
byday = [weekdaynum] day
weekdaynum = [minus] daynum
daynum = 1 through 53 /* if frequency is yearly */
daynum = 1 through 5 /* if frequency is monthly */
day = "MON" | "TUE" | "WED" | "THU" | "FRI" | "SAT" | "SUN"
byhour_clause = "BYHOUR" "=" hour_list
hour_list = hour ( "," hour)*
hour = 0 through 23
byminute_clause = "BYMINUTE" "=" minute_list
minute_list = minute ( "," minute)*
minute = 0 through 59
bysecond_clause = "BYSECOND" "=" second_list
second_list = second ( "," second)*
second = 0 through 59
bysetpos_clause = "BYSETPOS" "=" setpos_list
setpos_list = setpos ("," setpos)*
setpos = [minus] setpos_num
setpos_num = 1 through 9999
==============================
include_clause = "INCLUDE" "=" schedule_list
exclude_clause = "EXCLUDE" "=" schedule_list
intersect_clause = "INTERSECT" "=" schedule_list
schedule_list = schedule_clause ("," schedule_clause)*
schedule_clause = named_schedule [ offset ]
named_schedule = [schema ". "] schedule
periods_clause = "PERIODS" "=" periodnum
byperiod_clause = "BYPERIOD" "=" period_list
period_list = periodnum ("," periodnum)*
periodnum = 1 through 100
==============================
offset = ("+" | "-") ["OFFSET:"] duration_val
span = ("+" | "-" | "^") "SPAN:" duration_val
duration_val = dur-weeks | dur_days
dur_weeks = numofweeks "W"
dur_days = numofdays "D"
numofweeks = 1 through 53
numofdays = 1 through 376
minus = "-"
This grammar form looks extremely complex, in fact, practical very simple, the reason it looks complex, because its function is too flexible (before the Sansi series of notes, has been elaborated on the relationship between flexibility and complexity), here is not prepared to explain every grammar detail, the following will focus on some common settings, hoping to be more helpful to the understanding of the majority of colleagues.
For example: Set tasks to run only on week 5:
REPEAT_INTERVAL => 'FREQ=DAILY; BYDAY=FRI';
REPEAT_INTERVAL => 'FREQ=WEEKLY; BYDAY=FRI';
REPEAT_INTERVAL => 'FREQ=YEARLY; BYDAY=FRI';
The above three statements have the same function although the specified keywords are slightly different.
Set tasks to run every other week and only on the 5th of week:
REPEAT_INTERVAL => 'FREQ=WEEKLY; INTERVAL=2; BYDAY=FRI';
Set tasks to run on the last day of the month:
REPEAT_INTERVAL => 'FREQ=MONTHLY; BYMONTHDAY=-1';
The setup mission runs on March 10:
REPEAT_INTERVAL => 'FREQ=YEARLY; BYMONTH=MAR; BYMONTHDAY=10'; REPEAT_INTERVAL => 'FREQ=YEARLY; BYDATE=0310';
The above two statements have the same function.
Set tasks to run every 10 days:
REPEAT_INTERVAL => 'FREQ=DAILY; INTERVAL=10';
Setup tasks run at 4, 5, and 6 p.m. each day:
REPEAT_INTERVAL => 'FREQ=DAILY; BYHOUR=16,17,18';
Set tasks to run on the 29th of each month:
REPEAT_INTERVAL => 'FREQ=MONTHLY; BYMONTHDAY=29';
Set tasks to run in the last week of the year:
REPEAT_INTERVAL => 'FREQ=YEARLY; BYDAY=-1FRI';
Set tasks to run every 50 hours:
REPEAT_INTERVAL => 'FREQ=HOURLY; INTERVAL=50';
In addition, whether you miss the convenience of setting interval in regular job, although the function is weak, but the setting operation is very simple, no need to worry, in fact, REPEAT_INTERVAL in SCHEDULER can also be set in that way, as mentioned earlier, REPEAT_INTERVAL is actually a specified period, directly specifying a time value, of course, it is also a period.
For example, set the task to execute once a day, or set the REPEAT_INTERVAL parameter value as follows:
REPEAT_INTERVAL => 'trunc(sysdate)+1'
Another example is setting tasks to be performed once a week:
REPEAT_INTERVAL => 'trunc(sysdate)+7'
Note, however, that this method is only used to create jobs in SCHEDULE, not schedules.
Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.