Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have installed Oracle 11g, and I can connect as sysman to the Oracle database, but there is no tnsnames.ora file that I can find.

Do I need to generate the tnsnames.ora file myself? If so, where do I place it? If not, how does Oracle generate it for me? If I do need to generate it, what is the appropriate syntax for the file?

share|improve this question

migrated from stackoverflow.com Nov 7 '12 at 16:07

This question came from our site for professional and enthusiast programmers.

4 Answers 4

You can easily create a tnsnames.ora [text] file. It should be in $ORACLE_HOME/network/admin/ and should look something like this:

     (address = (protocol = TCP)(host = fu.bar)(port = 1521))
 (connect_data =
share|improve this answer
the netca is started as the first step. The dbca won't allow you to continue without having created a listener. This is the case for 11g anyway. –  Munchi Nov 7 '12 at 16:31
Noted, and edit made. –  BryceAtNetwork23 Nov 7 '12 at 17:10
Downvoted for linking a known bad Oracle advice site. Sorry. –  Phil Nov 7 '12 at 23:09
Noted and edited. –  BryceAtNetwork23 Nov 8 '12 at 2:46
@Phil don't think you got the above comment in your inbox as there was no explicit @Phil (needed because both you and Munchi had commented) –  Jack Douglas Dec 8 '12 at 10:28

The default directory for a tnsnames.ora file is



<alias> = (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = <ip>)(PORT = <port>))
      (SERVICE_NAME = <dbname>)
  • alias: you can choose this and use it as connection string later on.
  • port: the default is 1521

More info here: http://docs.oracle.com/cd/B28359_01/network.111/b28317/tnsnames.htm

share|improve this answer
The default directory is nothing of the sort. It's relative to $ORACLE_HOME and therefore will be $ORACLE_HOME/network/admin (where $ORACLE_HOME can be multiple different directories where there's more than one Oracle install/patch level) or can be overrided by the $TNS_ADMIN environment variable. It's completely up to the user where the software resides. –  Phil Nov 7 '12 at 23:07
Honestly it is the default on a linux system... If you don't touch a thing it will be put there... thus being the default. But $ORACLE_HOME if not tampered with is indeed a better solution. –  Munchi Nov 8 '12 at 23:44
I have run Oracle on literally hundreds of Linux systems and that is NOT the default, nor is there such a thing. Perhaps you mean that's the example in the documentation, well they had to choose something. There is no Linux distro that I know of that has a /u01 filesystem "by default", you must have created it and told Oracle to use it! –  Gaius Jun 26 '13 at 8:22

$ORACLE_HOME/network/admin is the directory wwhere tnsnames.ora file is created by DBCA and/or NetCA. An OracleHome path like /u01/app ... is an OFA compliant path that the installler uses as default if not overriden by installer.

share|improve this answer

As far as i know the tnsnames.ora needs to be placed at the <ORA_INSTALL_FOLDER>\product\11.1.0\client_1\network\admin\ folder

Documentation can be found here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.