oracle SqlDeveloper:清除网络别名列表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6412559/
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
SqlDeveloper: clear network alias list
提问by David Oneill
I use sql-developer to connect to several different oracle databases with several different users. The connection info is kept in a tnsnames.ora
file so that when a database changes servers, I don't have to manually update all my connections to it. I recently updated my tnsnames file, and now there are 2 entries in the network alias list for each one that should be there. The 2nd entry appears to work (IE passes the test when I test the connection). However, by default, it seems to choose the first entry, which doesn't work.
我使用 sql-developer 连接到几个不同用户的几个不同的 oracle 数据库。连接信息保存在一个tnsnames.ora
文件中,这样当数据库更改服务器时,我不必手动更新我的所有连接。我最近更新了我的 tnsnames 文件,现在网络别名列表中有 2 个条目,每个条目都应该在那里。第二个条目似乎有效(当我测试连接时,IE 通过了测试)。但是,默认情况下,它似乎选择了第一个条目,这不起作用。
I suspect this is due to the answer here: Oracle TNS names not showing when adding new connection to SQL Developerhowever, that answer doesn't address how to fix that problem.
我怀疑这是由于此处的答案:向 SQL Developer 添加新连接时未显示 Oracle TNS 名称,但是,该答案并未解决如何解决该问题。
So, how do I completely clear the network alias list and force it to re-load from the file?
那么,如何完全清除网络别名列表并强制它从文件中重新加载?
回答by David Oneill
It was grabbing an old copy of tnsnames.ora_OLD that I had in the same folder. According to:
它正在抓取我在同一文件夹中的 tnsnames.ora_OLD 的旧副本。根据:
http://forums.oracle.com/forums/thread.jspa?threadID=1017751
http://forums.oracle.com/forums/thread.jspa?threadID=1017751
"There is a longstanding?feature?with SQL Developer's TNS Names functionality where SQL Developer will find all of the matching tnsnames.ora* files in the TNS Admin directory and list the contents of all of them. For example, all of the TNS aliases defined in TNSNAMES.ORA, TNSNAMES.ORA~ and TNSNAMES.ORA.201001210957 will be included in the Network Alias list."
“SQL Developer 的 TNS Names 功能有一个长期存在的功能,SQL Developer 将在 TNS Admin 目录中找到所有匹配的 tnsnames.ora* 文件并列出所有文件的内容。例如,所有 TNS 别名在 TNSNAMES.ORA 中定义的 TNSNAMES.ORA~ 和 TNSNAMES.ORA.201001210957 将包含在网络别名列表中。”
Deleting that old file removed the extra entries.
删除那个旧文件删除了额外的条目。
回答by John Suh
I found that duplicated TNS names came from following two files; tnsnames.ora AND tnsnames.~ora
我发现重复的 TNS 名称来自以下两个文件;tnsnames.ora 和 tnsnames.~ora
Two options;
两种选择;
option 1. delete file " tnsnames.~ora"
选项 1. 删除文件“tnsnames.~ora”
option 2. if you have to keep this " tnsnames.~ora" in the folder, then rename it to like "tnsnames~ora.txt"
选项 2. 如果您必须在文件夹中保留此“tnsnames.~ora”,则将其重命名为“tnsnames~ora.txt”
** Please note, if you rename it "tnsnames.~ora.txt", it will still shows duplicated. My understanding is that if filename start with "tnsnames" and ends with "ora", it will gives you duplicated TNS names.
** 请注意,如果您将其重命名为“tnsnames.~ora.txt”,它仍然会显示重复。我的理解是,如果文件名以“tnsnames”开头并以“ora”结尾,它将为您提供重复的 TNS 名称。