tnsnames ora location oracle sql developer

TNSNames ORACLE SQL Developer: Setting Up Connection with ORA Location

By John Johnson
AD

When working with Oracle SQL Developer, correctly configuring the tnsnames.ora file is vital for ensuring a successful connection to your Oracle database. The tnsnames.ora file is a crucial resource that provides the database client with the necessary information to connect with the database server. But where exactly is this file located, and how can you set up and manage your tnsnames.ora entries? Let's delve into the world of the tnsnames.ora file to help you understand its location and how to work with it effectively in Oracle SQL Developer.

The tnsnames.ora file is typically located in a directory that is specified by the TNS_ADMIN environment variable. By default, this environment variable points to the ORACLE_HOME/dbs directory. For instance, on an Oracle 19c installation on Windows, the default path might be C:\oraclexe\app\oracle\product\19.0.0\dbhome_1\network\admin. On Linux, the path might look something like this: /u01/oracle/product/19.0.0/dbhome_1/network/admin.

The tnsnames.ora File: A Closer Look

The tnsnames.ora file is a plain text file that associates a unique service name or alias with the network connection details of an Oracle database. It contains a portion for each database server that the client can connect to, using its specific network settings. Understanding the structure of this file is crucial for correctly adding and managing your database connections.

AD
a computer user's resume for oracle
a computer user's resume for oracle
a screenshot of a page with the text's name and numbers on it
a screenshot of a page with the text's name and numbers on it
30 SQL COMMANDS EVERY DATABASE DEVELOPER SHOULD MASTER
30 SQL COMMANDS EVERY DATABASE DEVELOPER SHOULD MASTER

Each tnsnames entry follows a specific structure, usually consisting of the following components:

  • Alias: The name by which you can connect to the database.
  • Host: The host where the database resides.
  • Port: The port number on which the database listener is listening.
  • Sid: The system identifier for the database.

A typical tnsnames.ora entry might look something like this:

Oracle
Oracle
a poster with the words soljoins on it and an image of two circles
a poster with the words soljoins on it and an image of two circles
25 SQL QUERIES EVERY DEVELOPER SHOULD MASTER
25 SQL QUERIES EVERY DEVELOPER SHOULD MASTER
MYDB = (DESCRIPTION = (ADDRESS ЛиSTENER ( (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521)) )) (CONNECT_DATA = (SID = MYDB) ) )

Editing the tnsnames.ora File in Oracle SQL Developer

Oracle SQL Developer provides a convenient way to manage your tnsnames.ora file. To edit the file, simply follow these steps:

  1. Open Oracle SQL Developer.
  2. From the main menu, select “Tool” –> “Preferences”.
  3. In the left-hand tree, expand “Database”, and then click on "PNN".
  4. The “Name Servers” window provides an overview of the current tnsnames.ora entries. You can add, delete, or modify entries here.

Adding a New Entry to the tnsnames.ora File

To add a new database connection, you can create a new entry in the "Name Servers" window. Here's how to do it:

AD
  1. Open the "Name Servers" window as described above.
  2. Click on the “New” button to create a new entry.
  3. Enter the details for your new database, following the structure outlined above.
  4. Click “OK” to save the new entry.

The role of the sqlnet.ora File

While the tnsnames.ora file provides information about the database connections, the sqlnet.ora file is where you can find and control settings that apply to all SQL*Net connections. Common tasks here include configuring the listener configuration, adding new directories, or setting authentications parameters.

a blue and yellow poster with words on it that say, oracle data dictionary views
a blue and yellow poster with words on it that say, oracle data dictionary views
Oracle Database tutorial 67: How to create Tablespace using SQL Developer By RebellionRider
Oracle Database tutorial 67: How to create Tablespace using SQL Developer By RebellionRider
Oracle RoadMap
Oracle RoadMap
15 SQL Queries Every Developer Should Know (2026)
15 SQL Queries Every Developer Should Know (2026)
a red circle with the word oracle on it in front of a dark cityscape
a red circle with the word oracle on it in front of a dark cityscape
25 SQL QUERIES EVERY DEVELOPER SHOULD KNOW
25 SQL QUERIES EVERY DEVELOPER SHOULD KNOW

The location of the sqlnet.ora file is also governed by the TNS_ADMIN environment variable. To edit this file, use the same procedure outlined above for editing the tnsnames.ora file, but select "SQLNET" from the preferences tree instead of "PNN".

Setting the TNS_ADMIN Environment Variable

To change the location of the tnsnames.ora and sqlnet.ora files, you can set the TNS_ADMIN environment variable to a different directory. Here's how to do it on different operating systems:

AD
  • Windows: Set the variable in the system properties, or in the environment variables for the current command prompt session. Alternatively, you can add TNS_ADMIN to the ORACLE furthermore in the oracle.install.client.nt-32bit or oracle.install.client.nt-64bit batch file.
  • Linux: Set the variable in the /etc/profile file, or in a shell script that initializes the Oracle environment.

Having an understanding of the tnsnames.ora and sqlnet.ora files, their typical locations, and how to manage them in Oracle SQL Developer can greatly enhance your productivity. Whether you're working locally or remotely, location, location, location is key in establishing successful database connections. So, now that you're armed with this knowledge, happy database connecting!

Oracle SQL Performance Tuning - Assistance by Tosska
Oracle SQL Performance Tuning - Assistance by Tosska
SQL
SQL
an image of a diagram with the names and numbers
an image of a diagram with the names and numbers
an image of a table with the names and numbers for different types of data sources
an image of a table with the names and numbers for different types of data sources
SQL in 60 days
SQL in 60 days
a poster with the names and abbreviations of different types of items that are sold
a poster with the names and abbreviations of different types of items that are sold
a poster with the names and numbers for different types of objects in it, including circles
a poster with the names and numbers for different types of objects in it, including circles
Convert NVARCHAR to NUMERIC in SQL Server: The Complete No-Fail Handbook
Convert NVARCHAR to NUMERIC in SQL Server: The Complete No-Fail Handbook
a diagram with many different types of data
a diagram with many different types of data
four different types of soljoins with the names and numbers in each section on them
four different types of soljoins with the names and numbers in each section on them
an image of a circular diagram with the names and functions
an image of a circular diagram with the names and functions
AD