oracle schemadul and job

The newly launched SCHEDULER in 10g may indeed make many new friends feel dizzy. Compared with the previous jobs, there are too many new concepts in SCHEDULER. For example, jobs can still be understood as jobs in the previous version, but with more powerful functions (note that ordinary jobs can still be used in 10g, this is nonsense, I believe that friends who read this article should still be using this), for example Program, refers to the running program (single out what to do), such as schedule, I translate it into scheduling (job I translate into tasks), and define the frequency or cycle of execution.
3.1 Create and manage Schedule s
  Schedule, the Chinese literal translation should be understood as scheduling. From the name, it is a logical entity (logic, entity, so contradictory), that is to say, after the schedule is created, there must be this in the database. An object, but this object is used to describe the execution cycle of the job.
  Creating a schedule can be done through the DBMS_SCHEDULER.CREATE_SCHEDULE procedure, which supports the following parameters:
SQL> desc dbms_scheduler.create_schedule;Parameter Type Mode Default? --------------- ----------------------- - ---- -------- SCHEDULE_NAME VARCHAR2 IN START_DATE TIMESTAMP WITH TIME ZONE IN Y REPEAT_INTERVAL VARCHAR2 IN END_DATE TIMESTAMP WITH TIME ZONE IN Y COMMENTS VARCHAR2 IN Y        
  The meaning of each parameter is as follows:
SCHEDULE_NAME : Specify the schedule name, Note that names cannot be repeated. 

START_DATE : Specifies the start time of the schedule. It can be empty. When it is empty, it means that the schedule is temporarily unavailable. 

REPEAT_INTERVAL : Specifies the execution frequency or period of the schedule. 

END_DATE : Specifies the end time of the scheduling, which can be empty. If it is empty, it means that the scheduling will continue. 

COMMENTS : Comment information.
  Among them, the more technical content is the REPEAT_INTERVAL parameter. You should not be too unfamiliar with this parameter. Because Jobs was introduced earlier, the parameter of the same name was also mentioned. The REPEAT_INTERVAL parameter in Schedules has the same function as the REPEAT_INTERVAL parameter in Jobs. , even the parameter format is exactly the same.
  The syntax structure of the REPEAT_INTERVAL parameter is much more complex. The most important of which are the two keywords FREQ and INTERVAL.
The FREQ keyword is used to specify the time period of the interval. The optional parameters are: YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, and SECONDLY, which respectively represent units such as year, month, week, day, hour, minute, and second. 

The INTERVAL keyword is used to specify the frequency of the interval, and the value that can be specified ranges from 1-99.
  For example, when REPEAT_INTERVAL=>'FREQ=DAILY;INTERVAL=1'; is specified, it means that it is executed once a day, and if INTERVAL is changed to 7, it means that it is executed every 7 days, and the effect is equivalent to FREQ=WEEKLY;INTERVAL=1.
  Next, create a schedule and specify the frequency of the schedule as once a week. The execution script is as follows:
SQL> begin 2 DBMS_SCHEDULER.CREATE_SCHEDULE ( 3 schedule_name => 'my_first_schedule', 4 start_date => SYSDATE, 5 repeat_interval => 'FREQ=WEEKLY; INTERVAL=1', 6 comments => 'Every 1 weeks'); 7 END; 8 /PL/SQL procedure successfully completed.
  To query the currently created schedules, you can pass the *_SCHEDULER_SCHEDULES view (including DBA_,ALL_,
SQL> select schedule_name,repeat_interval from user_scheduler_schedules;SCHEDULE_NAME REPEAT_INTERVAL----------------------------- --------- ---------------------MY_FIRST_SCHEDULE FREQ=WEEKLY; INTERVAL=1
  If you want to modify the schedule attribute, you also use the DBMS_SCHEDULER.SET_ATTRIBUTE procedure, which has been called earlier It has been demonstrated many times, so I won't repeat the example here, just to explain that for schedule, the attributes that can be modified include: REPEAT_INTERVAL, COMMENTS, END_DATE, START_DATE, and EVENT_SPEC.
  As for deleting a schedule, it is as simple as executing the DBMS_SCHEDULER.DROP_SCHEDULE procedure, for example:
SQL> EXEC DBMS_SCHEDULER.DROP_SCHEDULE('MY_FIRST_SCHEDULE');PL/SQL procedure successfully completed.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325782193&siteId=291194637