本文介绍了向SQL Developer添加新连接时,不显示Oracle TNS名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用SQL Developer连接到oracle数据库。



我安装了.Net oracle驱动程序,并将 tnsnames.ora 文件放在

C:\Oracle\product\11.1.0\client_1\Network\Admin



我在tnsnames.ora中使用以下格式:

  dev = 
(DESCRIPTION =
(ADDRESS =(PROTOCOL = TCP)(HOST = 192.168.XXX.XXX)(PORT = XXXX))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = idpdev2)




在SQL Developer中,当我尝试创建一个新连接,没有TNS名称显示为选项。



有没有我缺少的东西?

方案

SQL Developer将按顺序查看以下位置的tnsnames.ora文件


  1. $ HOME / .tnsnames.ora

  2. $ TNS_ADMIN / tnsnames.ora

  3. 注册表中的TNS_ADMIN查找键

  4. etc / tnsnames.ora(non-windows)

  5. $ ORACLE_HOME / network / admin / tnsnames.ora

  6. LocalMachine \SOFTWARE\ORACLE\\ \\ ORACLE_HOME_KEY

  7. LocalMachine\SOFTWARE\ORACLE\ORACLE_HOME

如果您的tnsnames。 ora文件无法识别,请使用以下过程:


  1. 定义一个名为 TNS_ADMIN 指向包含tnsnames.ora文件的文件夹。



    在Windows中,导航到控制面板> 系统>



    在Linux中,在.profile文件中定义 TNS_ADMIN 变量



    从Windows命令中确认

    line:
    echo%TNS_ADMIN%



    来自linux:
    echo $ TNS_ADMIN


  2. 重新启动SQL Developer


  3. 现在,在SQL Developer中,右键单击连接,然后选择 。在下拉框中选择 TNS 作为连接类型。您现在应该在这里显示来自tnsnames.ora的输入。


I'm trying to connect to an oracle database with SQL Developer.

I've installed the .Net oracle drivers and placed the tnsnames.ora file at
C:\Oracle\product\11.1.0\client_1\Network\Admin

I'm using the following format in tnsnames.ora:

dev =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.XXX.XXX)(PORT = XXXX))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = idpdev2)
    )
  )

In SQL Developer, when I try to create a new connection, no TNS-names show up as options.

Is there something I'm missing?

解决方案

SQL Developer will look in the following location in this order for a tnsnames.ora file

  1. $HOME/.tnsnames.ora
  2. $TNS_ADMIN/tnsnames.ora
  3. TNS_ADMIN lookup key in the registry
  4. /etc/tnsnames.ora ( non-windows )
  5. $ORACLE_HOME/network/admin/tnsnames.ora
  6. LocalMachine\SOFTWARE\ORACLE\ORACLE_HOME_KEY
  7. LocalMachine\SOFTWARE\ORACLE\ORACLE_HOME

If your tnsnames.ora file is not getting recognized, use the following procedure:

  1. Define an environmental variable called TNS_ADMIN to point to the folder that contains your tnsnames.ora file.

    In Windows, this is done by navigating to Control Panel > System > Advanced system settings > Environment Variables...

    In Linux, define the TNS_ADMIN variable in the .profile file in your home directory.

  2. Confirm the os is recognizing this environmental variable

    From the Windows command line:echo %TNS_ADMIN%

    From linux:echo $TNS_ADMIN

  3. Restart SQL Developer

  4. Now in SQL Developer right click on Connections and select New Connection.... Select TNS as connection type in the drop down box. Your entries from tnsnames.ora should now display here.

这篇关于向SQL Developer添加新连接时,不显示Oracle TNS名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 05:04