oracle 在 SQL Developer 中哪里可以找到 tnsnames.ora?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47928570/
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-09 01:15:37  来源:igfitidea点击:

Where to find tnsnames.ora in SQL Developer?

oracledatabase-connectionoracle-sqldeveloper

提问by StanGeo

I need to find the tnsnames.ora file for my connections. My servers are hosted remotely i.e. I dont have it installed on my physcial system.

我需要为我的连接找到 tnsnames.ora 文件。我的服务器是远程托管的,即我没有在我的物理系统上安装它。

回答by thatjeffsmith

SQL Developer looks for tnsnames.ora files in the following locations:

SQL Developer 在以下位置查找 tnsnames.ora 文件:

  • your USER Home directory
  • $ORACLE_HOME\network\admin -- assumes you have a client installed
  • OS Environment Variable value for TNS_ADMIN
  • Registry entry for TNS_ADMIN
  • The location you specified in the preferences
  • 您的用户主目录
  • $ORACLE_HOME\network\admin -- 假设您安装了客户端
  • TNS_ADMIN 的操作系统环境变量值
  • TNS_ADMIN 的注册表项
  • 您在首选项中指定的位置

enter image description here

在此处输入图片说明

The last one will trump the others.

最后一个将胜过其他。

You can see this for yourself in a SQL Worksheet, by running the command

您可以通过运行以下命令在 SQL 工作表中亲眼看到这一点

show tns

enter image description here

在此处输入图片说明

You do not get a tnsnames.ora file 'for free.' Someone will need to build, maintain, and distribute one for and to you.

您不会“免费”获得 tnsnames.ora 文件。需要有人为您构建、维护和分发一个。

You can however connect to an Oracle Database without a TNSNames.ora file. Assuming you have all the information required (what's normally defined in the .ora file), you can make a 'Basic' connection.

但是,您可以在没有 TNSNames.ora 文件的情况下连接到 Oracle 数据库。假设您拥有所需的所有信息(通常在 .ora 文件中定义的信息),您可以建立“基本”连接。

enter image description here

在此处输入图片说明

Another quirk of the system - we actually read the entries in ANY file named tnsnames* - so if you have older versions of the file saved as something like tnsnames_old.ora or tnsnames.bak - we'll see and use those too, something SQL*Plus used to do and we were asked to follow as well.

系统的另一个怪癖——我们实际上读取了任何名为 tnsnames* 的文件中的条目——所以如果你有旧版本的文件保存为 tnsnames_old.ora 或 tnsnames.bak 之类的东西——我们也会看到并使用它们,一些 SQL *Plus 过去常常这样做,我们也被要求遵循。