Plsql Creating Oracle Timed Tasks

Source: Internet
Author: User

Plsql Creating Oracle Timed Tasks

Original yxtic

Read Catalogue
    • 1. Create a stored procedure for task execution, such as yxtestjob, inserting data into the test table
    • 2, the timer corresponding to the Dbms_jobs folder, right-click New
    • 3. Create a task
    • Note: Timing execution and time interval description for job
    • View Tasks

When using Oracle's most matching tool plsql, what if I create a timer with Plsql? Let me briefly describe how to create a timer using a tool:

1. Create a stored procedure for task execution, such as yxtestjob, inserting data into the test table
is begin  insert into Ztest (name,createdate)  values ('test', sysdate); end;    
2, the timer corresponding to the Dbms_jobs folder, right-click New

Back to top 3, create a task

(1), in what value to fill in the stored procedure to be executed, multiple can, separate

(2), in the interval to fill in the Execution time strategy, (the specific wording as described below remarks)

Note: Timing execution and time interval description for job

The interval/interval is the interval between the last execution and the next execution, and when interval is set to NULL, the job execution ends and is removed from the queue. If we need the job to be executed periodically, use ' sysdate+m '.
(1). Execute Every Minute
Interval = TRUNC (sysdate, ' mi ') + 1/(24*60)

Hourly execution

Interval = TRUNC (sysdate, ' hh ') + 1/(24)

(2). Daily scheduled execution
Example: Daily 1 o'clock in the morning execution
Interval = TRUNC (sysdate+ 1) +1/(24)

(3). Regular weekly execution
For example: Every Monday 1 o'clock in the morning execution
Interval = TRUNC (Next_day (sysdate, ' Monday ')) +1/24

(4). Regular monthly execution
For example: 1st 1 o'clock in the morning every month to execute
Interval =>trunc (Last_day (sysdate)) +1+1/24

(5). Scheduled execution per quarter
For example, the first day of each quarter is 1 o'clock in the morning execution
Interval = TRUNC (Add_months (sysdate,3), ' Q ') + 1/24

(6). Every half-yearly scheduled execution
For example: Every July 1 and January 1 1 o'clock in the morning
Interval = Add_months (trunc (sysdate, ' yyyy '), 6) +1/24

(7). Scheduled execution every year
For example: January 1 1 o'clock in the morning every year to execute
Interval =>add_months (trunc (sysdate, ' yyyy '), 12) +1/24

View Tasks

If you want to see some scripts, you can also view them by opening folders, or by using more convenient SQL statements.

1 SELECTFROMdba_jobs;

Note that if Next_date is 4000-1-1, the script is already in a stopped state.

Plsql Creating Oracle Timed Tasks

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.