What is TNSNames.ora file?
The TNSNames.ora file contains the specific information required to connect to the Oracle instance. By default, the TNSNames.ora file resides in {oracle home directory}\network\admin. For example, C:\Oracle_Client\network\admin.
If a TNSNames.ora file does not exist on the machine, you will need to create one in a text editor. We recommend storing the file in your My Documents folder as this is an easily identified folder and common on most machines. For example: C:\Users\gsbprogramming\Documents.
Sample TNSNames.ora entry
[net_service_name]= ( DESCRIPTION= ( ADDRESS=[protocol_address_information] ) ( CONNECT_DATA= ( SERVICE_NAME=[service_name] ) )
)
You can get this entry by using TNSPING
Here XE is SID of oracle database. So we used TNSPING XE
If SID is ORCL you will use:
TNSPING ORCL
So TNSNAMES.ORA will have entry as:
MYTNS=
( DESCRIPTION=
( ADDRESS = ( PROTOCOL = TCP ) ( HOST = ErJatt) ( PORT = 1521 ))
( CONNECT_DATA = ( SERVER = DEDICATED ) ( SERVICE_NAME = XE ))
)
Here ErJatt is username . You can also use 127.0.0.1 here
So write this in notepad
Save this file as TNSNAMES.ORA in any directory (For example: C:\Oracle\TNS_ADMIN\)
As we have saved this file in C:\Oracle\TNS_ADMIN\ so we will create a TNS_ADMIN system environment variable with value C:\Oracle\TNS_ADMIN\
Now tnsnames.ora will be automatically added to toad