[20180803]cursor_sharing = force.txt --//链接:https://jonathanlewis.wordpress.com/2018/06/23/cursor_sharing-force/ --//重复测试: SCOTT@test01p> @ ver1 PORT_STRING VERSION BANNER CON_ID ------------------------------ -------------- -------------------------------------------------------------------------------- ---------- IBMPC/WIN_NT64-9.1.0 12.1.0.1.0 Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production 0 create table t1 as select rownum n1, rownum n2, lpad(rownum,10) small_vc, rpad('x',100,'x') padding from dual connect by level <= 1e4 ; alter system flush shared_pool; alter session set cursor_sharing=force; declare m_ct number; m_n1 number := 20; begin execute immediate 'select /*+ trace this */ count(*) from t1 where n2 = 15 and n1 = :b1' into m_ct using m_n1; dbms_output.put_line(m_ct); execute immediate 'select /*+ trace this too */ count(*) from t1 where n1 = 15 and n2 = 15' into m_ct; dbms_output.put_line(m_ct); end; / --//alter session set cursor_sharing=exact; select sql_id, parse_calls, executions, rows_processed, sql_text from v$sql where sql_text like 'select%trace this%' and sql_text not like '%v$sql%' ; SQL_ID PARSE_CALLS EXECUTIONS ROWS_PROCESSED SQL_TEXT ------------- ----------- ---------- -------------- ---------------------------------------------------------------------------------------------------- cbu4s78h5pfj5 1 1 1 select /*+ trace this too */ count(*) from t1 where n1 = :"SYS_B_0" and n2 = :"SYS_B_1" cru67sufptx8x 1 1 1 select /*+ trace this */ count(*) from t1 where n2 = 15 and n1 = :b1 --//你可以发现有变量和常量的语句没有发生转换,很奇怪.而2个是变量的语句发生了转换. --//如果在sqlplus下执行: alter session set cursor_sharing=force; variable b1 number exec :b1 := 15; select /*+ SQL*Plus session */ count(*) from t1 where n2 = 15 and n1 = :b1; select sql_id, parse_calls, executions, rows_processed, sql_text from v$sql where sql_text like 'select%Plus session%' and sql_text not like '%v$sql%' ; SQL_ID PARSE_CALLS EXECUTIONS ROWS_PROCESSED SQL_TEXT ------------- ----------- ---------- -------------- ---------------------------------------------------------------------------------------------- gq2qy2a9yuta7 1 1 1 select /*+ SQL*Plus session */ count(*) from t1 where n2 = :"SYS_B_0" and n1 = :b1 --//而在sqlplus执行发生了转换.
[20180803]cursor_sharing = force.txt
来源:这里教程网
时间:2026-03-03 11:51:50
作者:
编辑推荐:
- word2010中显示分节符的两种技巧03-03
- [20180803]cursor_sharing = force.txt03-03
- word2010中如何插入标签03-03
- Word2010插入日期和时间的两种方法03-03
- Oracle 12.2 OJVM安装03-03
- word2010中怎样实现图片与文字互换03-03
- word2010如何利用文本框实现纵横混排03-03
- word2010中如何绘制分割线03-03
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- Oracle 12.2 OJVM安装
Oracle 12.2 OJVM安装
26-03-03 - Oracle—undo回滚段长时间不释放
Oracle—undo回滚段长时间不释放
26-03-03 - rhel7 udev
rhel7 udev
26-03-03 - OGG基础原理了解
OGG基础原理了解
26-03-03 - 12.2.0.1 Grid RUR 安装
12.2.0.1 Grid RUR 安装
26-03-03 - 甲骨文再遭打击,亚马逊计划2020年初完全弃用甲骨文的数据库
甲骨文再遭打击,亚马逊计划2020年初完全弃用甲骨文的数据库
26-03-03 - 12.2.0.1.0 Grid RU安装
12.2.0.1.0 Grid RU安装
26-03-03 - 12c RAC增加节点
12c RAC增加节点
26-03-03 - 12.2 Grid RUR 安装
12.2 Grid RUR 安装
26-03-03 - word2010中怎样设置水印
word2010中怎样设置水印
26-03-03
