暂无图片
暂无图片
2
暂无图片
暂无图片
暂无图片

ORACLE RAC中设置JOB,SCHEDULER JOB在指定实例执行

原创 范计杰 2021-11-26
3819


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 以外的环境,此属性没有用,因为只有一个实例。



「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论