oracle 如何在 Windows 10 中为 SQL Developer 设置 tnsnames.ora 位置

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

How to set tnsnames.ora location for SQL Developer in Windows 10

oraclewindows-10oracle-sqldevelopertnsnames

提问by thursdaysgeek

This question (Use tnsnames.ora in Oracle SQL Developer) looks like it should have the answer. But my copy of SQL Developer does not have Advanced under Database (it does have Advanced Parameters, but that's not helping).

这个问题(在 Oracle SQL Developer 中使用 tnsnames.ora)看起来应该有答案。但是我的 SQL Developer 副本在数据库下没有高级(它有高级参数,但这没有帮助)。

I've looked all through the preferences (and help), and can't find where to set it. The accepted answer has a nice picture and this:

我已经查看了所有首选项(和帮助),但找不到设置它的位置。接受的答案有一个很好的图片和这个:

In the Preferences options expand Database --> select Advanced --> under "Tnsnames Directory" --> Browse the directory where tnsnames.ora present.

在首选项选项中展开数据库 --> 选择高级 --> 在“Tnsnames 目录”下 --> 浏览 tnsnames.ora 所在的目录。

My picture mostly matches, but there is no Tnsnames Directory option at the bottom.

我的图片大多匹配,但底部没有 Tnsnames Directory 选项。

This link (http://www.oracle.com/technetwork/issue-archive/2008/08-may/o38sql-102034.html) gives the following useful information:

此链接 ( http://www.oracle.com/technetwork/issue-archive/2008/08-may/o38sql-102034.html) 提供了以下有用信息:

A TNS connection uses an alias entry from a tnsnames.ora file. Oracle SQL Developer uses only one tnsnames.ora file. You may have more than one on your local machine or want to use the tnsnames.ora file on a remote machine, so note that Oracle SQL Developer looks sequentially for the tnsnames.ora file in the following locations:

  1. $HOME/.tnsnames.ora
  2. $TNS_ADMIN/tnsnames.ora
  3. /etc/tnsnames.ora (non-Windows systems)
  4. $ORACLE_HOME/network/admin/tnsnames.ora
  5. Registry key

TNS 连接使用来自 tnsnames.ora 文件的别名条目。Oracle SQL Developer 仅使用一个 tnsnames.ora 文件。您的本地机器上可能有多个,或者想要在远程机器上使用 tnsnames.ora 文件,因此请注意 Oracle SQL Developer 会在以下位置按顺序查找 tnsnames.ora 文件:

  1. $HOME/.tnsnames.ora
  2. $TNS_ADMIN/tnsnames.ora
  3. /etc/tnsnames.ora(非 Windows 系统)
  4. $ORACLE_HOME/network/admin/tnsnames.ora
  5. 注册表项

I want the $ORACLE_HOME option to be used, but there appears to be a copy in one of the first 2 locations. And I'm not sure where $HOME or $TNS_ADMIN is defined (so I could just copy over my good copy there), or better yet, how to re-define it to use the one in $ORACLE_HOME.

我希望使用 $ORACLE_HOME 选项,但在前两个位置之一中似乎有一个副本。而且我不确定 $HOME 或 $TNS_ADMIN 在哪里定义(所以我可以在那里复制我的好副本),或者更好的是,如何重新定义它以使用 $ORACLE_HOME 中的那个。

采纳答案by Kris Rice

The sequence of checks you mentioned is correct. To see what the tool is using there's 2 choices

您提到的检查顺序是正确的。要查看该工具正在使用的内容,有 2 种选择

1 - In a worksheet type "show tns"

1 - 在工作表中输入“show tns”

SQL> show tns
TNS Lookup locations
--------------------

Location used:
-------------
    /Users/klrice

Available TNS Entries
---------------------
SQL> 

2 - Also in the worksheet issue this command.

2 - 同样在工作表中发出此命令。

setloglevel oracle.dbtools.raptor.utils INFO

Blog post with details here : http://krisrice.io/2008-04-16-it-seems-to-come-up-often-that-some/

详细信息的博客文章:http: //krisrice.io/2008-04-16-it-seems-to-come-up-often-that-some/

enter image description here

在此处输入图片说明