本文介绍了在Oracle Client中更改注册表中的NLS_LANG设置的影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在从.NET Microsoft oracle驱动程序迁移到ODP.NET驱动程序.

We are in the process of moving from the .NET Microsoft oracle driver to the ODP.NET driver.

我们遇到的一个问题是此错误:

One of the problems we have had is this error:

ORA-12705:无法访问NLS数据文件或指定的无效环境

ORA-12705: Cannot access NLS data files or invalid environment specified

我们能够通过修改注册表并更改设置来停止错误(看到此问题)

We were able to stop the error by modifying the registry and changing the setting (see this question)

在我们的情况下,我们进行了更改

In our case we changed

HKEY_LOCAL_MACHINE - SOFTWARE - ORACLE - NLS_LANG

设置为NA

HKEY_LOCAL_MACHINE - SOFTWARE - ORACLE - HOME0 - NLS_LANG

设置正确

我的问题是,为什么注册表中会有不同的NLS_LANG设置,更改此值可能会产生影响吗?

My question is why would there be different NLS_LANG settings in the registry, and might there be any knock on effects of changing this value?

更新:我刚刚在 Oracle NLS常见问题解答中找到了以下

Update:I've just found in the Oracle NLS FAQ the following

HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE

对于Oracle数据库版本8、8i和 9i:

For Oracle Database versions 8, 8i and 9i:

HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOMEx\

其中"x"是唯一数字 确定Oracle主目录.

where "x" is the unique number identifying the Oracle home.

HOME0是首次安装

HOME0 is the first installation

对于Oracle数据库10g:

For Oracle Database 10g:

HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_<oracle_home_name>

您有一个名称为的条目 NLS_LANG

There you have an entry with name NLS_LANG

好的,因此对于不同的版本有不同的注册表设置...

OK, so there are different registry settings for different versions...

有些人对找到一个 NLS_LANG在以下位置设置为"NA" HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE 没有安装版本7时.这 用于向后兼容, 并且可以忽略.

Some people are confused by finding a NLS_LANG set to "NA" in HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE when no version 7 was installed. This is used for backwards compatibility, and can be ignored.

我有Oracle 9i,所以现在我更加困惑-为什么ODP.NET dll会查看Oracle 7注册表设置?

I have Oracle 9i, so now I'm even more confused - why is the ODP.NET dll looking at the Oracle 7 registry setting?

推荐答案

在我们的案例中,我们不想对Oracle注册表进行任何潜在的重大更改,因为我们正在将Web服务安装在生产Oracle 9i服务器上.

In our case we did not want to make any potentially breaking changes to the Oracle registry because we were installing our web service on a production Oracle 9i server.

解决方案只是通过拒绝对我们的Web服务运行时使用的用户ID的所有访问来阻止ODAC看到任何ORACLE注册表项.

The solution was simply to prevent ODAC from being able to see any ORACLE registry keys by denying all access to that key for the user ID our web service was running as.

  1. 开始->运行... regedit (以管理员身份)
  2. 导航到HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE
  3. 右键单击ORACLE键->权限...
  4. 点击添加...按钮.
  5. 添加在您的Web服务的应用程序池标识中配置的Web服务用户名(例如IUSR_MyWebService);这是在任务管理器"中针对您的w3wp.exe进程显示的用户名.
  6. 按确定".
  7. 对于新用户权限,请针对完全控制"权限选中拒绝",然后按OK.
  1. Start -> Run... regedit (as an administrator)
  2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE
  3. Right click on the ORACLE key -> Permissions...
  4. Click the Add... button.
  5. Add the web service user name configured in your web service's application pool identity (e.g. IUSR_MyWebService); this is the user name that appears against your w3wp.exe process in Task Manager.
  6. Press OK.
  7. For the new user permissions, check "Deny" against the Full Control permission and press OK.

这很好用,并且作为一项奖励,我们确保了我们的应用程序与将来对ORACLE注册表项的更改无关.

This worked just fine and as a bonus we have ensured that our application is isolated from any future changes to the ORACLE registry keys.

提示:,您可以通过关闭注册表编辑器的任何正在运行的实例来证明自己,有关用户无权访问相关密钥,并在提示符下启动CMD提示符该用户(使用运行方式...),然后从命令提示符下启动regedit.

Tip: you can prove to yourself that the user in question has no access to the keys in question by closing any running instances of the Registry Editor, start a CMD prompt as that user (using Run As...) and then launching regedit from the command prompt.

这篇关于在Oracle Client中更改注册表中的NLS_LANG设置的影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 12:59