How to add network alias in SQL Developer+network alias+.ora

Open SQL Developer. Go to Tools -> Preferences -> Databases -> Advanced Then explicitly set the Tnsnames Directory

enter image description here

enter image description here

<<tnsnames.ora>>

####
#### ORACLE12c TEST INSTANCE
#### Server name: 132.186.137.132
####
NAME=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = HOST_NAME)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = SERVICE_NAME)
)
)

 

 

SQL Developer will look in the following location in this order for a tnsnames.ora file

  1. $HOME/.tnsnames.ora
  2. $TNS_ADMIN/tnsnames.ora
  3. TNS_ADMIN lookup key in the registry
  4. /etc/tnsnames.ora ( non-windows )
  5. $ORACLE_HOME/network/admin/tnsnames.ora
  6. LocalMachine\SOFTWARE\ORACLE\ORACLE_HOME_KEY
  7. LocalMachine\SOFTWARE\ORACLE\ORACLE_HOME

If your tnsnames.ora file is not getting recognized, use the following procedure:

  1. Define an environmental variable called TNS_ADMIN to point to the folder that contains your tnsnames.ora file.In Windows, this is done by navigating to Control Panel > System > Advanced system settings> Environment Variables…

    In Linux, define the TNS_ADMIN variable in the .profile file in your home directory.

  2. Confirm the os is recognizing this environmental variableFrom the Windows command line: echo %TNS_ADMIN%

    From linux: echo $TNS_ADMIN

  3. Restart SQL Developer
  4. Now in SQL Developer right click on Connections and select New Connection…. Select TNSas connection type in the drop down box. Your entries from tnsnames.ora should now display here.
Advertisements