Published by : Obay Salah , November 19, 2024

 In order for the Client to connect to the Database Server, it needs to know some information necessary for the success of the connection process:

1- The server or HOST where the Listener is working.

2- The port that the Listener is monitoring.

3- The protocol that the Listener is using.

4- The name of the service or instance that the Listener serves.

When the program or application requests to connect to the database through the Listener, it needs to know the information explained above to translate that into a successful communication process. As for how it processes this information to complete the communication process, there are several ways:

1 -Easy Connect:

In this type of connection, the user needs to write all the information that the client needs to connect to the database. This information is written during the connection process as follows:

<username>/<password>@<hostname>:<listener port>/<service name>

CONN SYSTEM/SYS@NBS:1521/ORCL 

Where NBS: is the name of the device that the Listener is working on.

1521: is the PORT that the Listener is monitoring.

ORCL: is the name of the Instance that the Listener serves.

This type is the easiest way to connect in that it does not need to be configured in the Client.

2-: Local Naming:

In the previous type of connection Easy Connect you need to write the information (port & host & name service) during the connection process which causes you some kind of difficulty, In this type of connection we do not need to write that with each connection process but we configure the file ORACLE_HOME/network/admin/tnsnames.ora$. If we are working on UNIX operating system

Or the file ORACLE_HOME%\NETWORK\ADMIN\TNSNAMES.ORA% if we are working on WINDOWS operating system.

So we create an alias for all the information required during the connection process, which is (host & name service & port & protocol)

So that this alias represents the above information, we do not need during the connection process to write the alias with the username and password username/password@alias,

We can put a list of alias configuration operations that represent the set of connections to the database in the file tnsnames.ora.


This is a sample file tnsnames.ora This Client can connect to databases using this file configuration.

Let's assume that the user in this Client typed the following statement:-

CONN USERNAME/PASSWORD@AKSLPNT1

The Client will translate the word AKSLPNT1 as:-

HOST: The name of the server containing the listener KASALA-DC.

PROTOCOL: The protocol it uses, which is TCP.

PORT: The port that the listener is monitoring.

SERVICE_NAME: The name of the SERVICE you want to connect to.

It is possible to test the Oracle Net Service aliases by running the tnsping command, then after that we write the alias name.

Tags : Database

You May Also Like

Comments

no comment yet!