目录
相关链接
- 【官】129-57 SYS.DBMS_SCHEDULER.enable
- 1. Excel目录
- 2. Oracle SYS.DBMS_SCHEDULER 目录
- 3. 129-41 SYS.DBMS_SCHEDULER.disable
- 4. 129-41 SYS.DBMS_SCHEDULER.enable
- 5. 129-41 SYS.DBMS_SCHEDULER.set_attribute
一、Summary of ENABLE Procedure
Enables a program, job, chain, window, database destination, external destination, file watcher, or group
启用程序、作业、链、窗口、数据库路径、外部路径、文件监视器或组。
二、ENABLE Procedure
This procedure enables a program, job, chain, window, database destination, external destination, file watcher, or group. When an object is enabled, its enabled
attribute 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.
此过程(dbms_scheduler.enable) 可启用程序(program),作业(job),链(chain job),时间窗口(window),数据库路径(database destination),外部路径(external destination),文件监视器( file watcher)。当一个对象的enabled属性被设置为TRUE,默认情况下,创建的作业、链和程序是禁用的,而创建数据库路径、外部路径、文件监视器、窗口和组是启用的。
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_COUNT
and RETRY_COUNT
columns in the *_SCHEDULER_JOBS
data dictionary views.
如果某个作业被禁用,启用后调度器将根据该作业的计划自动运行。启用一个被禁用的作业还会重置*_SCHEDULER_JOBS数据字典视图中的作业RUN_COUNT、FAILURE_COUNT和RETRY_COUNT列。
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.
在启用对象之前执行有效性检查。如果检查失败,则启用失败,并返回错误信息。如果对象已经启用,此过程不会返回错误。
三、ENABLE
3.1 Syntax 语法
参数有default值:可以不传参,使用默认值
参数无default值:必须传参才可调用
DBMS_SCHEDULER.ENABLE (
name IN VARCHAR2,
commit_semantics IN VARCHAR2 DEFAULT 'STOP_ON_FIRST_ERROR');
3.2 执行存储过程
1.如果是命令窗口就用exec 存储过程名,举个例子:
EXEC procedure;--procedure是存储过程名
2.如果是PL/SQL窗口就用 begin 存储过程名 end; 举个例子:
begin
procedure;--procedure是存储过程名
end;
3.如果是程序中调用就用 call 存储过程名 ,举个例子:
hibernateDao.excuteSqlUpdate("{Call proc_stuInfo()}");//存储过程proc_stuInfo
- plsql测试语句
begin
-- Call the procedure
sys.dbms_scheduler.enable(name => :name,
commit_semantics => :commit_semantics);
end;
3.3 Parameters 参数
Table 129-57 ENABLE Procedure Parameters
Ser 序号 | Parameter 参数名称 | Type 类型 | Default | IN / OUT | Note 参数说明 | Range 取值范围 |
---|---|---|---|---|---|---|
1 | name | VARCHAR2 | IN | The name of the object being enable. 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. 如果指定了作业类名,则启用该作业类(job class)中的所有作业(jobs)。 If a group name is specified, then the group is enabled , but the enabled state of the group members is unaffected. 如果指定了组名,则启用该组,但组成员的启用状态不受影响。 | [Any Name] | |
3 | commit_semantics | VARCHAR2 | Y | IN | The commit semantics. The following types are supported: 提交语义。支持以下类型: ● STOP_ON_FIRST_ERROR: The procedure returns on the first error and the previous enable operations that were successful 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 disabling a job or a list of jobs. In addition, this type is not supported when force is set to TRUE. 仅在启用作业或作业列表时才支持此类型。此外,当force设置为TRUE时,不支持此类型。 ● ABSORB_ERRORS: The procedure tries to absorb any errors and enable the rest of the jobs and commits all the enable operations that were successful. If errors occur, you can query the view SCHEDULER_BATCH_ERRORS for details. 该过程尝试吸收所有错误并启用其余作业,并提交所有成功的启用操作。如果出现错误,可以查询视图SCHEDULER_BATCH_ERRORS以获得详细信息。 This type is only supported when disabling a job or a list of jobs. 仅在启用作业或作业列表时才支持此类型。 | STOP_ON_FIRST_ERROR[default] TRANSACTIONAL ABSORB_ERRORS |
3.4 Usage Notes 使用方式
Windows must be preceded by SYS
.
时间窗口必须由SYS用户驱动
To run ENABLE
for a window or group of type WINDOW
, you must have the MANAGE
SCHEDULER
privilege. For a job of type EXECUTABLE
(or for a job that points to a program of type EXECUTABLE
), the job owner must have the CREATE EXTERNAL JOB
system privilege before the job can be enabled or run.
要为窗口或窗口组运行ENABLE,必须具有 MANAGE SCHEDULER 权限。对于可执行类型的作业(或指向可执行类型程序的作业),作业所有者必须具有 CREATE EXTERNAL JOB 权限,才能启用或运行该作业。
To enable a file watcher, the file watcher owner must have the EXECUTE
privilege on the designated credential1.
要启用文件监视器,文件监视器所有者必须具有EXECUTE权限指定证书。
You can use ENABLE
with any schema except the SYS
schema.
除了SYS模式(schema),可以enable任意其他模式(schema)。
20/12/8
M
credential:证书用来保存OS或者数据库的用户密码,在执行External Job 或者远程数据库作业时使用。 ↩︎