安装完ODTwithODAC112012,出现ORA-12560:TNS:协议适配器错误

参考:http://blog.csdn.net/tan_yixiu/article/details/6762357

操作系统:windows2008 Enterprise 64位

开发工具:VS2010

数据库:oracle11g

安装ODAC :ODTwithODAC112012后,出现ORA-12560:TNS:协议适配器错误

ODTwithODAC112012的下载地址:http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html

进入系统环境变量设置,查看Path路径,发现在安装ODAC时,同时安装了oracle客户端,

安装完成后发现在Path路径的最前面多了两个安装ODAC时产生的路径

F:appAdministratorproduct11.2.0client_1;

F:appAdministratorproduct11.2.0client_1in;

此时path路径为:F:appAdministratorproduct11.2.0client_1;F:appAdministratorproduct11.2.0client_1in;E:appAdministratorproduct11.2.0dbhome_1in;%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;%SYSTEMROOT%System32WindowsPowerShellv1.0;

这两个路径放到了oracle11g数据库路径前面,导致出现ORA-12560:TNS:协议适配器错误

将新加入的路径F:appAdministratorproduct11.2.0client_1;F:appAdministratorproduct11.2.0client_1in;置后(oracle数据库路径的后面)即可解决ORA-12560:TNS:协议适配器错误。

例如:将path修改为:E:appAdministratorproduct11.2.0dbhome_1in;%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;%SYSTEMROOT%System32WindowsPowerShellv1.0;F:appAdministratorproduct11.2.0client_1;F:appAdministratorproduct11.2.0client_1in;

解决ORA-12560:TNS:协议适配器错误。

接下来配置oracle客户端,否则VS2010无法连接到oracle数据

先找到 Oracle 数据库的安装目录,然后在其中找到如下目录

例如:我的安装在 E盘

E:appAdministratorproduct11.2.0dbhome_1NETWORKADMIN

在其中找到下面标记的两个文件:tnsnames.ora 和sqlnet.ora

然后将这两个文件拷贝到 Oracle Developer Tools for Visual Studio .NET 的安装目录下的以下目录,

例如:我的安装在F盘

F:appAdministratorproduct11.2.0client_1NetworkAdmin

然后便可以重启机器了,就可以了(注意我这个oracle数据库和Oracle Developer Tools for Visual Studio .NET 安装在同一台服务器上了)。

原文地址:https://www.cnblogs.com/wolfplan/p/3877263.html