ODBC 管理员找不到 Oracle TNS 名称文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11437522/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 04:19:31  来源:igfitidea点击:

ODBC Administrator Can't Find Oracle TNS Names File

oracleoracle11gwindows-server-2003tnsnames

提问by pixelbobby

With a new Oracle Installation when I go to Configuration Management Tools > Microsoft ODBC Administrator > System DSN > Add > [new installation]it does not have the TNSNAMES.ora connection name in the drop down. With the old installation, this had worked.

当我使用新的 Oracle 安装时Configuration Management Tools > Microsoft ODBC Administrator > System DSN > Add > [new installation],下拉列表中没有 TNSNAMES.ora 连接名称。使用旧的安装,这已经奏效了。

Create New Data Source

创建新数据源

I've tried updating Environment Paths and Registry keys but still can't find a way to get ODBC to see it in the drop down.

我已经尝试更新环境路径和注册表项,但仍然找不到让 ODBC 在下拉列表中看到它的方法。

enter image description here

在此处输入图片说明

There was a previous installation of Oracle Client on the Windows Server. I tried to remove most of the files but our Oracle DBA said we could just do another install and update the Environment Paths with the new location.

之前在 Windows Server 上安装了 Oracle Client。我试图删除大部分文件,但我们的 Oracle DBA 说我们可以再次安装并使用新位置更新环境路径。

I understand there are two other posts on SO hereand hereregarding this issue. However, I'm not sure TNS PING will help yet because it seems to be an issue regarding Environment Paths and ODBC being able to locate the .ora file.

我知道这里这里还有另外两篇关于这个问题的帖子。但是,我不确定 TNS PING 是否会有所帮助,因为它似乎是关于环境路径和 ODBC 能够定位 .ora 文件的问题。

TNSNAMES.ORA Location

TNSNAMES.ORA 位置

TNS_Admin = E:\app\[username]\product\11.2.0\client_1\network\admin\TNSNAMES.ora

TNS_Admin = E:\app\[username]\product\11.2.0\client_1\network\admin\TNSNAMES.ora

Environment Variables

环境变量

TNS_Admin = E:\app\[username]\product.2.0\client_1  
Path = E:\app\[username]\product.2.0\client_1

Registry Entries
home3 is the new installation. Should I delete the old registry key (home2)?HKLM\SOFTWARE\ORACLE\KEY_OraClient11g_home2and \..._home3

注册表项
home3 是新安装。我应该删除旧的注册表项 (home2) 吗?HKLM\SOFTWARE\ORACLE\KEY_OraClient11g_home2\..._home3

Also, if I select "OraClient11g_home2" in the Create New Data Source screen here is what is displayed in the drop down:

此外,如果我在“创建新数据源”屏幕中选择“OraClient11g_home2”,则下拉菜单中会显示以下内容:

enter image description here

在此处输入图片说明

采纳答案by pixelbobby

It appears the tumbleweed rolled by on this one but just for everyone who may be experiencing the same issue; I was able to fix this by using the Net Configuration Assistantwizard and providing the right information. It generated tnsnames.orain proper format ANDit should be noted that the filename given to me was tsnames.ora!

看起来风滚草在这个问题上滚滚而过,但只适用于可能遇到相同问题的每个人;我能够通过使用网络配置助手向导并提供正确的信息来解决这个问题。它产生的tnsnames.ora以适当的格式应该注意的是,给我的文件名是tsnames.ora

回答by Srinivas

If service name doesn't show in the dropdown, directly type in the service name and see if you are able to test the connection.

如果下拉列表中没有显示服务名称,请直接输入服务名称并查看是否能够测试连接。

enter image description here

在此处输入图片说明

回答by dr jerry

For the stupid souls like me: if you're writing out tnsnames.oravia notepad or so, make sure it doesn't have the .txtextension which is by (our) default not visible in windows explorer

对于像我这样愚蠢的灵魂:如果您tnsnames.ora通过记事本左右写出,请确保它没有.txt(我们的)默认扩展名在 Windows 资源管理器中不可见

回答by Becks TibiaFun

Make sure that:

确保:

  • Your tnsnames.orais encoded in ANSI and not UTF8.
  • You do not have special characters as ü??, not even in comments.
  • tnsnames.ora的编码是 ANSI 而不是 UTF8。
  • 你没有特殊字符 ü??,甚至在评论中也没有。

回答by Robert

Sorry to revive an ancient thread, but I had the same problem, and Net Configuration Assistant wouldn't run.

很抱歉恢复了一个古老的线程,但我遇到了同样的问题,并且网络配置助手无法运行。

(Windows XP SP3, Oracle 11gR2 client)

(Windows XP SP3,Oracle 11gR2 客户端)

SOLUTION:
1. Uninstall all otherOracle_Home instances using the Oracle (De-)Installer(don'tjust go deleting registry keys!), so that you only have the oneOracle_Home that you want to keep:
%oracle-home-that-you-want-to-keep%\client\oui\bin\setup.exe
2. Create or set Windows environment variables:
TNS_Admin = %oracle_home%\client_1\network\admin
Path = %oracle_home%\client_1;...
3. Reboot. (sigh...)

Anyway, that's what worked for me.

解决方案:
1.使用 Oracle (De-)Installer卸载所有其他Oracle_Home 实例(不要只是删除注册表项!),这样您就只有一个要保留的 Oracle_Home: 2. 创建或设置 Windows 环境变量:... 3. 重新启动。(叹气...) 无论如何,这对我有用。
%oracle-home-that-you-want-to-keep%\client\oui\bin\setup.exe

TNS_Admin = %oracle_home%\client_1\network\admin
Path = %oracle_home%\client_1;



回答by Chrisvb

For some reason windows 2012R2 did not have an ORACLE_HOME environment variables set. This can case issues so either add oracle_homeor tns_admin. Windows 2012 installs had a oracle_homevariable.

由于某些原因,Windows 2012R2 没有设置 ORACLE_HOME 环境变量。这可能会出现问题,因此添加oracle_hometns_admin. Windows 2012 安装有一个oracle_home变量。

回答by BSharp

Or just use a connection string that you enter in the textbox (the one that is supposed to get populated using the dropdownbox), e.g. 127.0.0.1/XE see here.

或者只使用您在文本框中输入的连接字符串(应该使用下拉框填充的字符串),例如 127.0.0.1/XE,请参见此处