DBMS_JOB
在创建时指定
DBMS_JOB.SUBMIT( job OUT BINARY_INTEGER, what IN VARCHAR2, next_date IN DATE DEFAULT SYSDATE, interval IN VARCHAR2 DEFAULT 'NULL', no_parse IN BOOLEAN DEFAULT FALSE, instance IN BINARY_INTEGER DEFAULT ANY_INSTANCE, <<< force IN BOOLEAN DEFAULT FALSE);
创建后修改
DBMS_JOB.INSTANCE
To assign a particular instance to execute a job, use the following syntax:
DBMS_JOB.INSTANCE( JOB IN BINARY_INTEGER,
instance IN BINARY_INTEGER,
force IN BOOLEAN DEFAULT FALSE) <<<示例
exec dbms_job.instance(10,1);
DBMS_SCHEDULER
DBMS_SCHEDULER.SET_ATTRIBUTE('jobname','instance_id',1);另一个相关的属性instance_stickiness
This attribute should only be used for a database running in an Oracle Real Application Clusters (Oracle RAC) environment. By default, it is set to TRUE. If you set instance_stickiness to TRUE, jobs start running on the instance with the lightest load and the Scheduler thereafter attempts to run on the instance that it last ran on. If that instance is either down or so overloaded that it does not start new jobs for a significant period of time, another instance runs the job. If the interval between runs is large, instance_stickiness is ignored and the job is handled as if it were a non-sticky job.
If instance_stickiness is set to FALSE, each instance of the job runs on the first instance available.
For environments other than Oracle RAC, this attribute is not useful because there is only one instance.
此属性应仅用于在 Oracle Real Application Clusters (Oracle RAC) 环境中运行的数据库。 默认情况下,它设置为 TRUE。
如果您将 instance_stickiness 设置为 TRUE,作业开始在负载最轻的实例上运行,然后调度程序会尝试在它上次运行的实例上运行。
如果该实例出现故障或过载以至于它在很长一段时间内无法启动新作业,则另一个实例会运行该作业。 如果运行之间的间隔很大,则忽略 instance_stickiness 并将作业作为非粘性作业进行处理。
如果 instance_stickiness 设置为 FALSE,则作业的每个实例都在第一个可用实例上运行。
对于 Oracle RAC 以外的环境,此属性没有用,因为只有一个实例。




