Oracle 并行相关的初始化参数


        Oracle数据库并行操作,特别是在RAC环境,一定程度上能够提升数据库的性能,所以对相关的初始化参数的了解是必要的,这篇文章将根据实际的案例讨论Oracle数据库的部分并行参数。

Oracle数据库相关的并行参数:

SQL> show parameter parallel

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- --------------------
fast_start_parallel_rollback         string                 LOW
parallel_adaptive_multi_user         boolean                TRUE
parallel_automatic_tuning            boolean                FALSE
parallel_degree_limit                string                 CPU
parallel_degree_policy               string                 MANUAL
parallel_execution_message_size      integer                16384
parallel_force_local                 boolean                FALSE
parallel_instance_group              string
parallel_io_cap_enabled              boolean                FALSE
parallel_max_servers                 integer                135
parallel_min_percent                 integer                0

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- --------------------
parallel_min_servers                 integer                0
parallel_min_time_threshold          string                 AUTO
parallel_server                      boolean                FALSE
parallel_server_instances            integer                1
parallel_servers_target              integer                64
parallel_threads_per_cpu             integer                2
recovery_parallelism                 integer                0

下面是实际Oracle RAC环境下,Oracle并行参数的设置,我们将优先讨论这些参数:
*.parallel_adaptive_multi_user=FALSE
*.parallel_execution_message_size=16384
*.parallel_max_servers=240
*.parallel_min_servers=0
*.parallel_threads_per_cpu=1

PARALLEL_ADAPTIVE_MULTI_USER

Property Description
Parameter type Boolean
Default value true
Modifiable ALTER SYSTEM
Range of values true | false

PARALLEL_ADAPTIVE_MULTI_USER, when set to true, enables an adaptive algorithm designed to improve performance in multiuser environments that use parallel execution. The algorithm automatically reduces the requested degree of parallelism based on the system load at query startup time. The effective degree of parallelism is based on the default degree of parallelism, or the degree from the table or hints, divided by a reduction factor.
当PARALLEL_ADAPTIVE_MULTI_USER参数设置为TRUE,启用设计的适当算法,在多用户环境下使用并行执行提升性能。这个算法基于查询开始时的系统负载自动减少请求的并行度。有效的并行度是基于默认的并行度,或者来自表或HINT的并行度,通过减少系数进行分割。

The algorithm assumes that the system has been tuned for optimal performance in a single-user environment.
算法假定系统在单用户环境下按照最优性能被调整。

Tables and hints use the default degree of parallelism.
表和HINT使用默认的并行度。


PARALLEL_MAX_SERVERS

Property Description
Parameter type Integer
Default value PARALLEL_THREADS_PER_CPU * CPU_COUNT * concurrent_parallel_users * 5
Modifiable ALTER SYSTEM
Range of values 0 to 3600
Oracle RAC Multiple instances can have different values.

Note:

This parameter applies to parallel execution in exclusive mode as well as in a Real Application Clusters environment.

PARALLEL_MAX_SERVERS specifies the maximum number of parallel execution processes and parallel recovery processes for an instance. As demand increases, Oracle Database increases the number of processes from the number created at instance startup up to this value.
PARALLEL_MAX_SERVERS指定实例最大并行执行进程和并行恢复进程数。随着增长需求,Oracle数据库需要增加进程数,从实例启动时创建的数目到增长值。

In the formula, the value assigned to concurrent_parallel_users running at the default degree of parallelism on an instance is dependent on the memory management setting. If automatic memory management is disabled (manual mode), then the value of concurrent_parallel_users is 1. If PGA automatic memory management is enabled, then the value of concurrent_parallel_users is 2. If global memory management or SGA memory target is used in addition to PGA automatic memory management, then the value of concurrent_parallel_users is 4.
根据上面的公式,分配给concurrent_parallel_users的值,运行在实例的默认并行度依赖于内存管理设置。如果禁用自动内存管理(手动模式),那么concurrent_parallel_user的值是1,如果启用PGA自动内存管理,那么concurrent_parallel_users的值是2。如果除了PGA自动内存管理外,还使用了全局内存管理或者SGA内存target,那么concurrent_parallel_users的值是4。

If you set this parameter too low, then some queries may not have a parallel execution process available to them during query processing. If you set it too high, then memory resource shortages may occur during peak periods, which can degrade performance.
如果设置这个参数过小,那么某些查询在查询过程中可能没有并行执行进程活动。如果设置这个参数过大,那么在峰值期间内存资源可能不足,导致性能下降。



PARALLEL_MIN_SERVERS

Property Description
Parameter type Integer
Default value 0
Modifiable ALTER SYSTEM
Range of values 0 to value of PARALLEL_MAX_SERVERS
Oracle RAC Multiple instances can have different values.

Note:

This parameter applies to parallel execution in exclusive mode as well as in a Real Application Clusters environment.

PARALLEL_MIN_SERVERS specifies the minimum number of parallel execution processes for the instance. This value is the number of parallel execution processes Oracle creates when the instance is started.
PARALLEL_MIN_SERVERS指定实例并行执行进程数的最小值。这个值是实例在启动时,Oracle创建的并行执行进程数。


PARALLEL_THREADS_PER_CPU

Property Description
Parameter type Integer
Default value Operating system-dependent, usually 2
Modifiable ALTER SYSTEM
Range of values Any nonzero number

Note:

This parameter applies to parallel execution in exclusive mode as well as in a Real Application Clusters environment.

PARALLEL_THREADS_PER_CPU specifies the default degree of parallelism for the instance and determines the parallel adaptive and load balancing algorithms. The parameter describes the number of parallel execution processes or threads that a CPU can handle during parallel execution.
PARALLEL_THREADS_PER_CPU指定实例默认的并行度,确定合适的并行和负载均衡算法。这个参数描述并行执行进程数,或者在并行执行期间CPU能处理的线程数。

The default is platform-dependent and is adequate in most cases. You should decrease the value of this parameter if the machine appears to be overloaded when a representative parallel query is executed. You should increase the value if the system is I/O bound.
默认值依赖于平台,在大多数情况下都是合适的。当执行一个典型的并行查询时,服务器出现过载的情况,应该减少这个参数的值。如果系统在I/O的边界应该增加这个值。


在并行参数方面,有以下最佳实践:

  • 确保监控活动并行服务器进程的数量并计算要应用于 PARALLEL_MIN_SERVERS 的平均值。可通过以下操作完成:
Select * from v$pq_syssstat;
Then: Get/save the value for row "Servers Highwater"
  • 根据您的硬件情况优化 PARALLEL_MAX_SERVERS的值。最开始可以使用 (2 * ( 2 个线程 ) *(CPU_COUNT)) = 4 x CPU 计算,然后使用测试数据对更高的值重复测试。
  • 考虑设置 FAST_START_PARALLEL_ROLLBACK。此参数可确定将有多少个进程用于事务恢复(在 redo 应用后执行)。为了确保在出现计划外故障后仍能获得高效的工作负载,优化事务恢复显得非常重要。只要系统不大量占用 CPU,最佳实践是将此参数设置为值“HIGH”。这会导致 Oracle 使用四倍于 CPU 个数 (4 X cpu_count) 的并行进程进行事务恢复。此参数的默认值是“LOW”,或两倍的 CPU 计数 (2 X cpu_count)。 
  • 对于 11gR2 之前的版本,将 PARALLEL_EXECUTION_MESSAGE_SIZE 从默认值(通常为 2048)增加到 8192。对于基于数据仓库的系统(通过 PQ 传输大量数据),可以将其设置的更高。在版本 11gR2 中,PARALLEL_EXECUTION_MESSAGE_SIZE 的默认值是 16K,经证明,该值在大多数情况下都能够满足要求。 

        参考文章:《 RAC 和 Oracle Clusterware 最佳实践和初学者指南(平台无关部分) [ID 1526083.1]


告警日志:
        在某些数据库启动的时候还能从告警日志的最开始位置看到以下的信息:
Tue May 07 23:38:27 2013
Adjusting the default value of parameter parallel_max_servers
from 1280 to 985 due to the value of parameter processes (1000)
Starting ORACLE instance (normal)

        出现此告警的原因是默认计算出的parallel_max_server的值1280超过了process的最大值1000,动态调整到小于process的值。


--end--


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23135684/viewspace-761919/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/23135684/viewspace-761919/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值