签到成功

知道了

CNDBA社区CNDBA社区

Oracle 19c SQL Version 说明

2024-01-21 11:42 536 0 原创 Oracle 19c
作者: dave

1 SQL Version 说明

Troubleshooting: High Version Count Issues (Doc ID 296377.1)
High Version Counts For SQL Statements (>1024) Post Upgrade To 12.2 and Above Causing Database Slow Performance (Doc ID 2431353.1)

http://www.cndba.cn/dave/article/131505

可以从 AWR 报告查看SQL Version,也可以通过如下 SQL 查看:

select count() as version_count, sql_id from v$sql where is_obsolete = ‘N’group by sql_id having count() > 100;http://www.cndba.cn/dave/article/131505http://www.cndba.cn/dave/article/131505

http://www.cndba.cn/dave/article/131505

过高的 SQL Version 也就意味着当子游标过多,如果 SQL 又执行的很频繁,可能会导致 CPU 使用率过高,mutex 争用,从而影响数据库的性能。http://www.cndba.cn/dave/article/131505

http://www.cndba.cn/dave/article/131505

在 Oracle 11.2.0.3 的版本中引入了一个隐含参数来控制 SQL Version:_cursor_obsolete_threshold,当SQL版本超过这个参数设定后,直接舍弃这个游标,重新解析,重头开始。

在 11.2.0.3 版本之前,只能通过补丁和参数(”_cursor_features_enabled” 和 event 106001)可以达成类似的效果。

该隐含参数在不通的版本里默认值也不同:http://www.cndba.cn/dave/article/131505

11.2.0.3: _cursor_obsolete_threshold=100
11.2.0.4: _cursor_obsolete_threshold=1024
12.1: _cursor_obsolete_threshold=1024
12.2 onwards: _cursor_obsolete_threshold=8192

可以看到在 12.2 以后默认值已经改到 8192 了。如果出现了这性能问题,可以考虑修改该参数的值。

2 修改 SQL Version 参数

SQL> col PARAMNAME for a50
SQL> col SESSIONVALUE for a15
SQL> col INSTANCEVALUE for a15
SQL> set lines 190
SQL> select paramName,SessionValue,InstanceValue from hparams where paramname='_cursor_obsolete_threshold';

PARAMNAME                                          SESSIONVALUE    INSTANCEVALUE
-------------------------------------------------- --------------- ---------------
_cursor_obsolete_threshold                         8192            8192

SQL>

这个参数是静态参数,需要通过 spfile 修改,重启生效:

http://www.cndba.cn/dave/article/131505

SQL> alter system set “_cursor_obsolete_threshold”=1024 scope=spfile;http://www.cndba.cn/dave/article/131505http://www.cndba.cn/dave/article/131505

版权声明:本文为博主原创文章,未经博主允许不得转载。

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
dave

dave

关注

人的一生应该是这样度过的:当他回首往事的时候,他不会因为虚度年华而悔恨,也不会因为碌碌无为而羞耻;这样,在临死的时候,他就能够说:“我的整个生命和全部精力,都已经献给世界上最壮丽的事业....."

  • 2246
    原创
  • 3
    翻译
  • 554
    转载
  • 188
    评论
  • 访问:6919557次
  • 积分:4275
  • 等级:核心会员
  • 排名:第1名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ