Home > Database > Oracle > How to set Oracle scheduled task to be executed every half hour

How to set Oracle scheduled task to be executed every half hour

下次还敢
Release: 2024-04-18 16:03:12
Original
1102 people have browsed it

Oracle scheduled tasks can be set to be executed every half hour through the following steps: 1. Create a scheduled task and set the repeat interval to 30 minutes. 2. Create a task and specify the scheduled task name and stored procedure as the task operation. 3. Create a stored procedure that contains the logic that needs to be executed. 4. Enable scheduled tasks.

How to set Oracle scheduled task to be executed every half hour

How to set Oracle scheduled tasks to be executed every half hour

1. Create scheduled tasks

<code class="SQL">BEGIN
  DBMS_SCHEDULER.CREATE_SCHEDULE(
    schedule_name => 'JOB_SCHEDULE',
    start_date => SYSDATE,
    repeat_interval => 'FREQ=MINUTELY;INTERVAL=30',
    end_date => NULL
  );
END;
/</code>
Copy after login

2. Create tasks

<code class="SQL">BEGIN
  DBMS_SCHEDULER.CREATE_JOB(
    job_name => 'JOB_NAME',
    job_type => 'STORED_PROCEDURE',
    schedule_name => 'JOB_SCHEDULE',
    job_action => 'BEGIN EXECUTE_JOB(); END;'
  );
END;
/</code>
Copy after login

3. Create a stored procedure to execute scheduled tasks

<code class="SQL">CREATE OR REPLACE PROCEDURE EXECUTE_JOB
AS
BEGIN
  -- 在此处编写需要执行的任务逻辑
END;
/</code>
Copy after login

4. Enable scheduled tasks

<code class="SQL">BEGIN
  DBMS_SCHEDULER.ENABLE(job_name => 'JOB_NAME');
END;
/</code>
Copy after login

The above is the detailed content of How to set Oracle scheduled task to be executed every half hour. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template