转 rac中并行 PARALLEL 的设置

sample 1: 

rac中并 行的设置

https://blog.csdn.net/wll_1017/article/details/8285574

      我们的生产库一般在节点一上的压力比较大,在节点二上的压力比较小,对内存、cpu等的观察也是在节点二使用率比较低,所以在节点二上建索引并且开了并行,可是发现开了并行后,建索引都在节点一上运行。通过在网上查找资料,发现可以用过参数限制只节点上运行开并行的语句。

instance_groups,静态参数,指定实例所属的组,组名用逗号隔开                                                                                                                          
parallel_instance_group,动态参数,可在会话级别进行修改,指定并行所使用的组。为空和为ALL时,说明并行可以开在数据库的所有实例上。

RAC1.instance_groups='RAC','RAC1'
RAC2.instance_groups='RAC','RAC2'
RAC1.parallel_instance_group='RAC1' # 在节点一上运行的语句开并行后再节点一上运行
RAC2.parallel_instance_group='RAC2' # 在节点二上运行的语句开并行后再节点二上运行

alter session set parallel_instance_group='RAC'; 可以在任何一个节点上执行并行

当设置parallel_instance_group为instance_groups中不存在的group时,并发就无法开启或者直接报错

SQL> select instance_name,instance_number from gv$instance;

INSTANCE_NAME  INSTANCE_NUMBER
---------------- ---------------
rac1          1
rac2          2

SQL> show parameter instance_group
 
NAME         TYPE  VALUE
------------------------------------ ----------- ------------------------------
instance_groups        string
parallel_instance_group       string

SQL> alter session set parallel_instance_group='rac';

Session altered.

SQL> show parameter instance_group

NAME         TYPE  VALUE
------------------------------------ ----------- ------------------------------
instance_groups        string
parallel_instance_group       string  rac
SQL>

sample 2

11g RAC数据库多节点并行操作开关 - PARALLEL_FORCE_LOCAL

PARALLEL_FORCE_LOCAL
 
PARALLEL_FORCE_LOCAL如果指定为TRUE, 并行操作只会在当前instance里面并行,而不会垮多节点,在11g R2 默认为FALSE,   如果想跨多个节点运行并行操作, 可以设置为 false  。  


例子: 

每周日 22:00  运行全量CBO

begin
  execute immediate 'alter session set parallel_force_local=false';
  dbms_stats.gather_database_stats(estimate_percent => 100,
                                   method_opt       => 'for all indexed columns',
                                   options          => 'GATHER',degree => 128);
end;




其它每天 22:00,运行增量
begin
  execute immediate 'alter session set parallel_force_local=false';
  dbms_stats.gather_database_stats(estimate_percent => dbms_stats.auto_sample_size,
                                   method_opt       => 'for all indexed columns',
                                   options          => 'GATHER AUTO',degree => 32);
end;
 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/35489/viewspace-774145/,如需转载,请注明出处,否则将追究

原文地址:https://www.cnblogs.com/feiyun8616/p/10310917.html