SQL>begin
dbms_scheduler.create_job (
job_name => 'test_job',
job_type => 'plsql_block',
job_action => 'null;',
enabled => true);
end;
/
SQL> -- wait a while
SQL>
select * from dba_scheduler_jobs where job_name='TEST_JOB';
select * from dba_scheduler_job_run_details where job_name='TEST_JOB';
select owner, job_name, job_style, job_creator,job_action, start_date, repeat_interval,last_start_date, last_run_duration, next_run_date,comments ,instance_id
from DBA_SCHEDULER_JOBS a where job_name='TEST_JOB';
begin
dbms_scheduler.create_job(
job_name => 'TEST_JOB',
job_type => 'plsql_block',
job_action => 'null',
start_date => systimestamp,
repeat_interval => 'freq=secondly; interval=5',
end_date => null,
enabled => true
);
END ;
begin dbms_scheduler.set_attribute(name => 'TEST_JOB'
,attribute => 'INSTANCE_ID'
,VALUE => '');------重置为NULL
end;
begin dbms_scheduler.set_attribute(name => 'TEST_JOB'
,attribute => 'INSTANCE_ID'
,VALUE => '3');
end;
select owner, job_name, job_style, job_creator,job_action, start_date, repeat_interval,last_start_date, last_run_duration, next_run_date,comments ,instance_id
from DBA_SCHEDULER_JOBS a where job_name='TEST_JOB';
begin
dbms_scheduler.run_job( 'TEST_JOB',FALSE); ---use another session
END ;
begin
dbms_scheduler.drop_job( 'TEST_JOB' );
END ;
本文详细介绍了如何在Oracle数据库中使用DBMS_SCHEDULER创建一个名为TEST_JOB的PL/SQL块作业,设置重复间隔,运行和管理该作业,以及如何重置和删除它。
7803

被折叠的 条评论
为什么被折叠?



