Oracle11g bright and blind eye Task Management

Source: Internet
Author: User

When using Oracle9i, oracle's task scheduling is poor. Recently, I browsed oracle11g and felt that oracle had greatly improved its ease of use. It not only became very simple in terms of memory management, storage management, and SQL tuning, A unified and complete solution is provided for task management. The following is an overview of task management:

The task management of Oracle11g uses the dbms_scheduler package.

1. Basic concepts of Scheduler


<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + signature 6za/cjno7o8L3A + cjxwp?vcd4kpha + QkVHSU48L3A + signature "HR. DO_BACKUP ',

Job_type => 'executable ',

Job_action => '/home/usr/dba/rman/nightly_incr.sh ',

Start_date => fig (SYSDATE) + 23/24,

Enabled => TRUE,

Repeat_interval => 'trunc (SYSDATE + 1) + 123 ',

/* Next night at 11: 00 PM */

Comments => 'nightly incremental backups ');

END;

Create_job overload function, you can directly use program (suddenly seeing this kind of object-oriented overload, I feel that it is back to the beautiful age of programming ):

BEGIN

DBMS_SCHEDULER.CREATE_PROGRAM (

Program_name => 'calc _ STATS2 ',

Program_action => 'hr. UPDATE_SCHEMA_STATS ',

Program_type => 'stored _ PROCEDURE ',

Enabled => TRUE );

DBMS_SCHEDULER.CREATE_JOB (

Job_name => 'hr. GET_STATS2 ',

Program_name => 'hr. CALC_STATS2 ',

Start_date = & gt; '20-DEC-0707.00.00 AM Greenwich ',

Repeat_interval => 'freq = HOURLY; INTERVAL = 2 ',

End_date = & gt; '20-DEC-04 07.00.00 AM Greenwich ',

Comments => 'explicitly scheduled job ');

END;

/


Create_job overload function, you can also directly use schedule:

BEGIN

DBMS_SCHEDULER.CREATE_SCHEDULE (

Schedule_name => 'stats _ schedule ',

Start_date => policimestamp,

End_date => policimestamp + INTERVAL '30' DAY,

Repeat_interval => 'freq = HOURLY; INTERVAL = 4 ',

Comments => 'every 4 hours ');

DBMS_SCHEDULER.CREATE_JOB (

Job_name => 'admin. GET_STATS ',

Program_name => 'admin. CALC_STATS2 ',

Schedule_name => 'stats _ schedule ');

END;


2. Advanced Scheduler concepts

The basic scheduler concept is sufficient in most cases. That is to say, even if we do not know these advanced features, oracle will assign some default values for use. The advanced schedule introduces the concepts of time window and task scheduling:

Windows is defined as windows group. For example, NIGHT window and WEEKEND window are combined into MAINTENANCE window group. A job can be specified to the MAINTENANCE window, which will be executed when NIGHT or WEEKEND windows is enabled.

A job can use schedule, window, or a window group as schedule. However, they are mutually exclusive and can only use one of them.

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.