We help IT Professionals succeed at work.

How to update TNSNAMES.ora

JustinW
JustinW asked
on
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?

Thanks,
-JW
Comment
Watch Question

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

http://www.orafaq.com/wiki/Tnsnames.ora
Top Expert 2011

Commented:
<dbaaliashere> =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(Host = <hostname/ipaddresshere>)(Port = <defaultportusually1521>))
   )
 (CONNECT_DATA =
   (SERVICE_NAME = <databasesid>)
 )
)

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

Commented:
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
Commented:
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

Commented:
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.