【翻译自mos文章】SYS_OP_C2C 导致的全表扫描(fts)/全索引扫描

SYS_OP_C2C 导致的全表扫描(fts)/全索引扫描

参考原文:

SYS_OP_C2C Causing Full Table/Index Scans (Doc ID 732666.1)

适用于:

Oracle Database - Enterprise Edition - Version 10.1.0.2 to 12.1.0.1 [Release 10.1 to 12.1]

Information in this document applies to any platform.

This problem can occur on any platform.

症状:

1)正在执行一个带有绑定变量的查询

2)绑定变量经由application(.net, j2ee等)使用 "string" 类型的绑定变量来绑定。

3)该查询错误的执行了全表扫描/索引扫描,而没有使用索引唯一扫描或者索引范围扫描

4)使用advanced 选项查看explain plan, sqltxlain or 10053 trace,你会注意到在"Predicate Information"部分  会显示一个 "filter(SYS_OP_C2C)".

e.g select * from table(dbms_xplan.display_cursor(&sql_id,null,‘ADVANCED‘));

Predicate Information (identified by operation id):

---------------------------------------------------

1 - filter(SYS_OP_C2C("COL1")=:B1)            <=== filter operation occurring

原因:

"string" 绑定变量 与 table 中的该 column 使用了不同的数据类型

这意味着 当执行这个查询的时候,需要把数据进行一个隐式类型转换。 SYS_OP_C2C 是一个隐式函数(implicit function),该函数用于字段(列)在nchar和char之间转换

解决方案:

1. 建立一个基于函数的索引。

e.g create index <index_name> on <table_name> (SYS_OP_C2C(<column>));

或者:

2.让绑定变量定义的数据类型与该列的数据类型一致。

A java example where this can occurs is when defaultNChar=TRUE.  This will cause strings to bind as NVARCHAR2 causing the predicate that are subset datatypes to be converted to NVARCHAR2.

e.g.    -Doracle.jdbc.defaultNChar=true

<connection-property name="defaultNChar">true</connection-property>

【翻译自mos文章】SYS_OP_C2C 导致的全表扫描(fts)/全索引扫描,布布扣,bubuko.com

时间: 2024-07-30 13:50:12

【翻译自mos文章】SYS_OP_C2C 导致的全表扫描(fts)/全索引扫描的相关文章

【翻译自mos文章】在alter/drop表空间时遇到错误ORA-38301,ORA-00604,purge dba_recyclebin 也不行

在alter/drop表空间时遇到错误ORA-38301,ORA-00604,purge dba_recyclebin 也不行 适用于: Oracle Database - Enterprise Edition - Version 10.2.0.1 and later Information in this document applies to any platform. 症状: 当你试图drop一个empty的tablespace时,遇到与recyclebin相关的错误 SQL> drop

【翻译自mos文章】 怎么对Microsoft (Office) Word Document 2007 索引化?

怎么对Microsoft (Office) Word Document 2007 索引化? 来源于:How To Index a Microsoft (Office) Word Document 2007 ? (文档 ID 752710.1) 适用于: Oracle Text - Version: 11.1.0.7 to 11.2.0.3 - Release: 11.1 to 11.2 Information in this document applies to any platform. 目

【翻译自mos文章】使用索引快速全扫(index ffs) 来避免全表扫描

使用索引快速全扫(index ffs) 来避免全表扫描 参考原文: Index Fast Full Scan Usage To Avoid Full Table Scans (Doc ID 70135.1) 适用于: Oracle Database - Enterprise Edition - Version 7.3.0.0 to 11.2.0.3 [Release 7.3.0 to 11.2] Information in this document applies to any platfo

【翻译自mos文章】对于oracle 数据库来说,OGG的抽取进程什么时候到database中获取数据?

对于oracle 数据库来说,OGG的抽取进程什么时候到database中获取数据? 参考原文: When GoldenGate Fetches Data From The Database On Extraction For Oracle (Doc ID 1059583.1) 适用于: Oracle GoldenGate - Version 4.0.0 and later Information in this document applies to any platform. 解决方法: 问

【翻译自mos文章】使用asmcmd命令在本地和远程 asm 实例之间 拷贝asm file的方法

使用asmcmd命令在本地和远程 asm 实例之间 拷贝asm file的方法 参考原文: How to Copy asm files between remote ASM instances using ASMCMD command (Doc ID 785580.1) 适用于: Oracle Database - Enterprise Edition - Version 11.1.0.6 to 11.2.0.2 [Release 11.1 to 11.2] Information in thi

【翻译自mos文章】怎么样kill 一个被挂起的自动物化视图刷新job?

怎么样kill 一个被挂起的自动物化视图刷新job? 参考原文:How to kill a hung automated materialized view refresh job (文档 ID 341842.1) 适用于: Oracle Server - Enterprise Edition - Version 8.1.5.0 to 10.2.0.5 [Release 8.1.5 to 10.2] Information in this document applies to any plat

【翻译自mos文章】rman 备份时报:ORA-02396: exceeded maximum idle time

rman 备份时报:ORA-02396: exceeded maximum idle time 参考原文: RMAN backup faling with ORA-02396: exceeded maximum idle time, please connect again (Doc ID 1446182.1) 适用于: Oracle Server - Enterprise Edition - Version 11.2.0.1 and later Information in this docu

【翻译自mos文章】使用aum( Automatic Undo Management) 时遇到 ORA-01555错误--- 原因和解决方案。

使用aum( Automatic Undo Management) 时遇到 ORA-01555错误--- 原因和解决方案. 参考原文: ORA-01555 Using Automatic Undo Management - Causes and Solutions (Doc ID 269814.1) 适用于: Oracle Database - Enterprise Edition - Version 9.0.1.0 and later Information in this document

【翻译自mos文章】11gR2中的asm后台进程

11gR2中的asm后台进程 参考原文: ASM Background Processes in 11.2 (Doc ID 1641678.1) 适用于: Oracle Database - Enterprise Edition - Version 11.2.0.2 to 11.2.0.4 [Release 11.2] Information in this document applies to any platform. 1 ASMB - ASM Background Process 与as