开发者

Commandline to modify tnsnames.ora [closed]

开发者 https://www.devze.com 2022-12-11 12:13 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 3 years ago.

Improve this question

Is there a command line utility to modify the tnsnames.ora file for the oracle client?

[EDIT] I'm looking fo开发者_开发技巧r something similar to odbcconf.exe (for editing ODBC connection on windows) to modify the tnsnames.ora file.

[EDIT2] I'm using MSBUILD from my automated build script. The MSBuild Community Tasks Project has an AddTnsName task that fits exactly what I need. My googling skillz must be weak. I should have been searching for MSBuild and tnsnames.ora instead of command line tnsnames.ora. However, it does surprise me that Oracle does not supply a command line utility like odbcconf for tnsnames.ora.


You can provide the whole TNS string as the connection parameter:

sqlplus "scott/tiger@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=MYSERVICE)))"

Alternatively, if your client supports EasyConnect syntax, you can go just this:

sqlplus scott/tiger@//127.0.0.1/MYSERVICE


IMO, this file is best maintained with an editor, but there is a Net Configuration Assistant GUI that will lead you through the steps to create one.

[Edit] I see from your additional comments now that you're looking for a scriptable way to add entries, and the direct answer to your question is no, there's no Oracle utility to do this. You'll have to come up with some cat|sed|awk solution on your own.


vi? notepad? um ...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号