ORACLE 并行度监控 19c

发布时间 2023-05-31 16:06:45作者: 蚌壳里夜有多长

oracle 并行度查看通过v$resource_limit 中的parallel_max_servers 参数来设置初始值

官方对于parallel_max_servers 参数设置

parallel_max_servers = PARALLEL_THREADS_PER_CPU * CPU_COUNT * concurrent_parallel_users * 5
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.
The value is capped by processes -15 (this is true for versions prior 11.2.0.2 as well).
As example we have the following values

parallel_threads_per_cpu  = 2
cpu_count                 = 4
pga_aggregate_target      = 500M
sga_target                = 900M
processes                 = 150

parallel_max_servers = 2 * 4 * 4 * 5 = 160
parallel_max_servers = min( 150-15 , 160 ) = 135

检查v$resource_limit中CURRENT_UTILIZATION 当前使用的并行度与设置的parallel_max_servers参数也就是(v$resource_limit中INITIAL_ALLOCATION列值)进行比较超过90%告警,

select case when b>=90 then 'gaojing' else 'zhengchang' end baidubi from (select trunc(CURRENT_UTILIZATION /INITIAL_ALLOCATION*100,1) b from v$resource_limit where RESOURCE_NAME='parallel_max_servers');

当结果大于90%告警