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

utlrp.sql并行问题

原创 黄宸宁 2014-04-18
928
今天一朋友提到执行utlrp.sql会执行并行操作,在某些时候可能导致达到oracle设置的上限。来看看utlrp.sql里面是如何定义的
 
Rem ===========================================================================
Rem BEGIN utlrp.sql
Rem ===========================================================================
@@utlprp.sql 0
Rem ===========================================================================
Rem END utlrp.sql
Rem =====

可以看到实际是调用的utlprp.sql命令,这里的参数0代表什么意思喃,接着看utlprp.sql中是如何定义的
DECLARE
threads pls_integer := &&1;
BEGIN
utl_recomp.recomp_parallel(threads);
END;
/
Rem INPUTS
Rem The degree of parallelism for recompilation can be controlled by
Rem providing a parameter to this script. If this parameter is 0 or
Rem NULL, UTL_RECOMP will automatically determine the appropriate
Rem level of parallelism based on Oracle parameters cpu_count and
Rem parallel_threads_per_cpu. If the parameter is 1, sequential
Rem recompilation is used. Please see the documentation for package
Rem UTL_RECOMP for more details.

可以看到这里的0就是在控制并行方式:
0:基于参数CPU_COUNT来自动设置并行度
1:以串行方式
N:以N个并行度进行编译。
而且在ultprp.sql 中还提到
   This script automatically chooses serial or parallel recompilation
based on the number of CPUs available (parameter cpu_count) multiplied
by the number of threads per CPU (parameter parallel_threads_per_cpu).
On RAC, this number is added across all RAC nodes.

所以有时候在RAC中执行utlrp.sql的时候会出现很长时间都无法运行完毕的时候,这种情况下可以改为串行来进行。
修改方法:
1.直接utlrp.sql中的@@utlprp.sql 0,把0改为1
2.或则修改ultprp.sql中的
DECLARE
threads pls_integer := &&1;
BEGIN
utl_recomp.recomp_parallel(threads);
END;
/
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论