DotNet编程-星光伴我行

滴滴真谛 水滴石穿

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

原因:
ODTwithODAC112030安装后,新装了一个oracle11G客户端,ODP.NET是通过 oracle11G客户端连接服务名访问的,
但在安装后的"C:\app\furenjun\product\11.2.0\client_1\Network\Admin"文件夹中没有对服务命名进行配置。
致Oracle.DataAccess.dll 不能解析oracle连接服务名。

解决方法:
将 原来装的 C:\oracle\product\10.2.0\db_1\network\ADMIN 目录下的 tnsnames.ora 文件 复制到
新装的 C:\app\furenjun\product\11.2.0\client_1\Network\Admin 文件夹下即可。

 

 

oracle的官方解释:

======================================================

http://www.oracle.com/technetwork/cn/topics/odt-faq-085407.html#ORA-12154:_TNS:could_not_resolve_the

ORA-12154: TNS:could not resolve the connect identifier specified

Scenario: You just installed Oracle Developer Tools, and now you cannot connect to the database using a Oracle connect alias that has worked in the past. You get a ORA-12154 error when you attempt to connect.

Cause: When you install Oracle Developer Tools, it typically creates a new "Oracle Home" (a new Oracle subdirectory, for example C:\oracle\product\10.2.0\my_new_home ) Each Oracle home maintains it's own copy of your connect aliases in a file called TNSNAMES.ORA. When you try to connect from this new Oracle home, none of your old connect aliases will exist in the new copy of TNSNAMES.ORA, therefore you get this error. They need to be copied over to the new Oracle home.

Solution: Copy <OLD_ORACLE_HOME>\NETWORK\ADMIN\TNSNAMES.ORA to <NEW_ORACLE_HOME>\NETWORK\ADMIN\TNSNAMES.ORA .
In some configurations, copying SQLNET.ORA and LDAP.ORA files from the same directory above may also be required.

Additionally:
64-bit Windows users who after doing the above steps still get ORA-12154 should either: 1) Upgrade to the latest version of their Oracle client that contains the fix for bug 3807408, or 2) rename subdirectories in their application that contain parenthesis to remove those parenthesis, in particular: C:\Program Files (x86)\Microsoft SQL Server and C:\Program Files(x86)\Microsoft Visual Studio 8

 

======================================================
我电脑上的开发环境:

======================================================
VS.NET 2010
Oracle 10G
ODP.Net  (  ODTwithODAC112030.zip,下载地址:http://www.oracle.com/technetwork/database/windows/downloads/index-101290.html
ODAC 11.2 Release 5 (11.2.0.3.20) with Oracle Developer Tools for Visual Studio

posted on 2013-06-14 10:45  DotNet编程  阅读(3851)  评论(0编辑  收藏  举报