• ODP.NET 开发 出现 ORA12154: TNS:could not resolve the connect identifier specified 错误


    原因:
    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

  • 相关阅读:
    windows server 2008 R2 安装 sql server 2000 遇到的种种问题
    圆心的VPS记录信息
    无法访问.您可能没有权限使用网络资源.局域网无法访问共享,局域网无法访问打印机的一些方法
    win7 32位 fastcgi模式 运行php
    SpringBoot+JPA实例
    马斯洛的锤子论
    一道算法题
    MySQL源码解读之数据结构LF_HASH
    JS学习专辑外传(1)
    WPF 用DynamicResource动态样式切换
  • 原文地址:https://www.cnblogs.com/furenjun/p/odpnet.html
Copyright © 2020-2023  润新知