How to Add a TNS Entry on a Local Host

A guide to configuring your Windows `hosts` file to connect to Oracle Apps R12.

Understanding the `hosts` File

Before you can connect to an Oracle database using a hostname (like `ebs.example.com`) in your `tnsnames.ora` file, your computer needs to know which IP address that hostname points to. The Windows `hosts` file is a simple text file that acts as a local DNS resolver, allowing you to manually map IP addresses to hostnames. This guide shows you how to edit it.

Step-by-Step Guide

Step 1: Open Notepad as Administrator

Click on the Start menu, search for 'Notepad', right-click on it, and select 'Run as administrator'. This is crucial because the hosts file is a protected system file.

Step 2: Open the 'hosts' file

In Notepad, go to File > Open. Navigate to the directory C:\Windows\System32\drivers\etc. You may need to change the file type from 'Text Documents (*.txt)' to 'All Files' to see the 'hosts' file. Select it and click Open.

Step 3: Add the Host Entry

Go to the end of the file and add a new line for your Oracle server. The format is IP Address, followed by a space or tab, and then the hostname. For example: 192.168.1.5 ebs.example.com

Step 4: Save the File

After adding the entry, go to File > Save to save your changes. You can now use the hostname 'ebs.example.com' in your tnsnames.ora file or other connection tools, and your computer will know it points to 192.168.1.5.