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.
<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>
<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>
<code class="SQL">CREATE OR REPLACE PROCEDURE EXECUTE_JOB AS BEGIN -- 在此处编写需要执行的任务逻辑 END; /</code>
<code class="SQL">BEGIN DBMS_SCHEDULER.ENABLE(job_name => 'JOB_NAME'); END; /</code>
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!