We help IT Professionals succeed at work.

How to update TNSNAMES.ora

JustinW asked
I'm trying to access a database that isn't in my current
TNSNAMES.ora file.

How do I update that file to show all database connections
on my server?

Watch Question

here is an example configuration that shows how to add your own databases.

Top Expert 2011

<dbaaliashere> =
     (ADDRESS = (PROTOCOL = TCP)(Host = <hostname/ipaddresshere>)(Port = <defaultportusually1521>))
   (SERVICE_NAME = <databasesid>)

- make sure the closing bracket match the open bracket.
Most Valuable Expert 2012
Distinguished Expert 2019

Oracle can be picky about the syntax of the file.  You can try manually editing it like mentioned above or run the Network configuration assistant to add additional entries.
Most Valuable Expert 2011
Top Expert 2012
there isn't really a server-to-tnsnames dump utility.

you'll have to go to your server, for each listener you have running, check the listener.ora for statically registered databases.  create corresponding entries in your tnsnames.ora for each of those databases.

if you have any dynamically registered databases, you'll have to check which of those are registered to each listener.  

lsnrctl status  

will show you which db's are registered to a listener,  check status for each listener you have running

You can use a basic text editor to add the entries into your TNSNAMES.ora file.
Otherwise, if your not savy with the format, you can use the netca tool in $ORACLE_HOME/bin for a GUI wizard. You'll still have to provide the database information, however, it will make the correct formatted entires in the TNSNAMES.ora file for you.