DBMS_SCHEDULER.CREATE_JOB
2013-04-07 10:33
495 查看
CREATE OR REPLACE PROCEDURE "SCOTT"."PRINT_NOW_TIME" is date_now_char varchar2(255); begin select to_char(sysdate,'yyyy/mm/dd HH:MI:SS') into date_now_char from dual; dbms_output.put_line(date_now_char); insert into date_time values(sysdate); commit; end;
BEGIN DBMS_SCHEDULER.CREATE_JOB ( job_name => 'TIME_JOB', job_action => 'PRINT_NOW_TIME', job_type => 'STORED_PROCEDURE', repeat_interval => 'FREQ=MINUTELY', comments => 'Daily at noon'); END; /
begin dbms_scheduler.enable('TIME_JOB'); end;
实现每分钟执行一次'TIME_JOB',即每分钟把当前时间插入date_time表
下面是参考的一部分
ENABLE Procedure
This procedure enables a program, job, chain, window, database destination, external destination, file watcher, or group. When an object is enabled, itsenabledattribute is set to
TRUE. By default, jobs, chains, and programs are created disabled and database destinations, external destinations, file watchers, windows, and groups are created enabled.
If a job was disabled and you enable it, the Scheduler begins to automatically run the job according to its schedule. Enabling a disabled job also resets the job
RUN_COUNT,
FAILURE_COUNTand
RETRY_COUNTcolumns in the
*_SCHEDULER_JOBSdata dictionary views.
Validity checks are performed before enabling an object. If the check fails, the object is not enabled, and an appropriate error is returned. This procedure does not return an error if the object was already enabled.
Syntax
DBMS_SCHEDULER.ENABLE ( name IN VARCHAR2, commit_semantics IN VARCHAR2 DEFAULT 'STOP_ON_FIRST_ERROR');
Parameters
Table 128-57 ENABLE Procedure Parameters
Parameter | Description |
---|---|
name | The name of the Scheduler object being enabled. Can be a comma-delimited list of names. If a job class name is specified, then all the jobs in the job class are enabled. If a group name is specified, then the group is enabled, but the enabled state of the group members is unaffected. |
commit_semantics | The commit semantics. The following types are supported:STOP_ON_FIRST_ERROR- The procedure returns on the first error and previous successful enable operations are committed to disk. This is the default. TRANSACTIONAL- The procedure returns on the first error and everything that happened before that error is rolled back. This type is only supported when enabling a job or a list of jobs. ABSORB_ERRORS- The procedure tries to absorb any errors and enable the rest of the jobs. It commits all the enable operations that were successful. If errors occur, you can query the view SCHEDULER_BATCH_ERRORSfor details. This type is only supported when enabling a job or a list of jobs. |
Name | Description |
---|---|
FREQ | This specifies the type of recurrence. It must be specified. The possible predefined frequency values are YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, and SECONDLY. Alternatively, specifies an existing schedule to use as a user-defined frequency. |
INTERVAL | This specifies a positive integer representing how often the recurrence repeats. The default is 1, which means every second for secondly, every day for daily, and so on. The maximum value is 99. |
相关文章推荐
- 122 The user SYS creates a job by using the following command: BEGIN DBMS_SCHEDULER.CREATE_JOB ( job
- 0327定时执行--存储过程--dbms_job--dbms_scheduler.create_job
- oracle10g dbms_scheduler.create_job 创建job简单实例
- oracle job,通过DBMS_SCHEDULER.CREATE_JOB来创建,管理也通过DBMS_SCHEDULER这个包来管理
- Oracle下查看dbms_job、dbms_scheduler_job创建的任务计划的job
- oracle定时任务dbms_job与dbms_scheduler使用方法
- 用 DBMS_SCHEDULER 代替 DBMS_JOB
- dbms_job vs Oracle Scheduler
- 11g中的DBMS_JOB和DBMS_SCHEDULER
- 通过DBMS_scheduler定义job,实现DB多线程并行处理
- Oracle - dbms_job vs. dbms_scheduler
- 10g里 DBMS_SCHEDULER 和 DBMS_JOB 区别
- Oracle jobs(DBMS_JOB and DBMS_SCHEDULER)
- 用dbms_scheduler创建job
- 用dbms_scheduler创建job
- dbms_scheduler job raise_events dequeue
- 系统包dbms_job维护作业,dbms_scheduler调度的问题
- DBMS_SCHEDULER 带参数JOB
- dbms_scheduler包中job(作业)学习
- dbms_scheduler vs dbms_job