views:

368

answers:

3

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

[EDIT] I'm looking for 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.

+2  A: 

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.

dpbradley
+2  A: 

vi? notepad? um ...

David Aldridge
+3  A: 

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
Quassnoi