Comprehensive learning of Oracle schedams feature (5) jobs executed by schedules scheduling programs

Source: Internet
Author: User
3.2 schedules schedule jobs executed by programs

Through schedule to schedule the job executed by the program, you can see whether the description is completely dizzy, it means you still do not understand10gSchedulers features inManagementThe meaning of jobs, let the three ideas more straightforward to describe to you. Version 10gSchedulerThe job is divided into multiple parts, the program is responsible for what to do, and the schedule is responsible for what to do, the job is simple, one word: Do.

In the previous sections, think twice has demonstrated how to create and manage jobs, create and manage programs, and create and manage schedules. The following example demonstrates how to use instances, how to Create a job to schedule the execution of a program through schedule.

First, create a program as follows:

    SQL> begin

    2 dbms_scheduler.create_program (

    3 program_name => 'my _ program1 ',

    4 program_action => '/bin/date ',

    5 program_type => 'executable ',

    6 enabled => true );

    7 end;

    8/

    PL/SQL procedure successfully completed.

Using the preceding statement, we define a program, execute the operating system command date, and input it to the DT. log file.

Next, define a schedule as follows:

    SQL> begin

    2 dbms_scheduler.create_schedule (

    3 schedule_name => 'my _ first_schedule ',

    4 start_date => sysdate,

    5 repeat_interval => 'freq = daily; interval = 1 ',

    6 comments => 'every 1 weeks ');

    7 end;

    8/

    PL/SQL procedure successfully completed.

It is defined to be executed once a week. Here, repeat_interval can be modified Based on the implementation.

Finally, create a job and run the program according to the specified schedule. The operation is as follows:

    SQL> begin

    2 dbms_scheduler.create_job (

    3 job_name => 'execoscmd ',

    4 program_name => 'my _ program1 ',

    5 schedule_name => 'my _ first_schedule ',

    6 enabled => true );

    7 end;

    8/

    PL/SQL procedure successfully completed.

When creating a job, you do not need to specify start_date, repeat_interval, and job_action because these parameters are controlled by program and schedule.

In this way, after the operation is completed, Oracle will automatically perform the operations defined in the program on a regular basis (currently set to run once a week.

To view the current execution status, use * _ scheduler_job_run_details to query (* _ scheduler_job_log is also acceptable, but the information in this view is not as comprehensive as in detail ). For example, to view the execution status of the created "execoscmd" task, run the following command:

    SQL> select log_id, log_date, status, additional_info

    2 from user_scheduler_job_run_details

    3 where job_name = 'execoscmd'

    4;

    Log_id log_date status additional_info

    ----------------------------------------------------------------------

    13760 17-aug-09 02.47.53.7 succeeded

    34050 PM +

After reading this example, do you know more about the scheduler feature in 10 Gb? Tens of millions of tables are complacent. Where are more scheduler features? Let's take a look.

 

Http://space.itpub.net/7607759/viewspace-612496

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.