How do I generate a tnsnames.ora file to connect to an Oracle Database?
You can easily create a tnsnames.ora [text] file. It should be in $ORACLE_HOME/network/admin/ and should look something like this:
ORATST=
(description=
(address_list=
(address = (protocol = TCP)(host = fu.bar)(port = 1521))
)
(connect_data =
(service_name=oratst)
)
)
The default directory for a tnsnames.ora file is
/u01/app/oracle/product/<version>/<dbname>/network/admin/tnsnames.ora
Contents:
<alias> = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = <ip>)(PORT = <port>))
(CONNECT_DATA =
(SERVER = DEDICATED)
(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
If your OS is Windows 10, you can find tnsnames.ora
file in the following unc path:
C:\app\myAccount\product\11.2.0\dbhome_1\NETWORK\ADMIN
Where myAccount
is your Windows account name.