ORACLE 11g case insensitive by default

被刻印的时光 ゝ 提交于 2019-11-29 07:26:49

You could just set the NLS_SORT, NLS_COMP parameters mentioned in the article as the values in the the Oracle init file using the alter system set <parameter> = <value>; clause.

Info on using the alter system commands can be found here.

Here is a good link on the correct usage of the NLS_* parameters. Note that some settings of of the NLS_SORT parameter can/could cause performance issues, namely when it is not set to BINARY. The Oracle docs state:

Setting NLS_SORT to anything other than BINARY causes a sort to use a full table scan, regardless of the path chosen by the optimizer. BINARY is the exception because indexes are built according to a binary order of keys. Thus the optimizer can use an index to satisfy the ORDER BY clause when NLS_SORT is set to BINARY. If NLS_SORT is set to any linguistic sort, the optimizer must include a full table scan and a full sort in the execution plan.

geekzspot

Sure you can!

Get your friendly DBA to set these parameters:

ALTER SYSTEM SET NLS_COMP=LINGUISTIC SCOPE=SPFILE; 

ALTER SYSTEM SET NLS_SORT=BINARY_AI SCOPE=SPFILE; 

This is taken from my short article on How to make Oracle Case Insensitive

Joey Gibson

I tried using a logon trigger to issue these commands to get case-insensitive queries:

execute immediate 'alter session set NLS_SORT=BINARY_CI';
execute immediate 'alter session set NLS_COMP=LINGUISTIC';

And while that did give me CI, it also gave me unbelievably bad performance issues. We have one table in particular that, without those settings, inserts take 2 milliseconds. With those settings in place, inserts took 3 seconds. I have confirmed this by creating and dropping the trigger multiple times.

I don't know if doing it at the system level, as opposed to the session level with a trigger, makes a difference or not.

I found the same performance issue with inserts and nls in 11g r2! Luckily for me the performance hit was not significant enough requiring an app change.

If you can do without binary_ci for the INSERT, then I would do an alter session just before the insert and afterwards, so you don't have to drop the trigger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!