SQLNET: How does Oracle Client connect with Oracle Server

Lets first try to understand what is Oracle Server and what is Oracle Client:

Oracle Database Server:
Oracle Database Server is usually a physical machine running one or more Oracle Database Instance along with its Database, which also facilitate by providing a connection mechanism to database using listener.

Oracle Client:
Oracle Client is usually a process or a program on a machine, which tries to connect to Oracle Database Server. Oracle Client can exist on any computer usually connected to Oracle Database Server machine by a network. It may be on Same Oracle Database Server also.

Now lets understand what happens when an Oracle Client tries to connect to Oracle Database Server in happy scenario i.e. every thing is up and running and properly configured. Lets try to understand it by what happens when we try to connect Oracle Server by sqlplus as

sqlplus scott/tiger@orcl

Steps / Process Involved
1) Operating System locates “sqlplus” and pass command line parameter “scott/tiger@orcl”
2) sqlplus now asks TNS to connect to “orcl” using user “scott” and password “tiger”
3) TNS now looks into “tnsnames.ora” file to find out the meaning of “orcl”. Default location of the file is “$ORACLE_HOME/network/admin” and most probably has entry for “orcl” like

ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ngarg.mydomain.co.in)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.mydomain.co.in)
    )
  )

4) Now it will try to connect Oracle Database Server Machine “ngarg.mydomain.co.in” on port 1521.
5) On Oracle Database Server there will be a listener running on 1521 port, listening to “orcl” service.
6) The listener will assign a server process to client.

General Issues we can face in connecting Oracle Client to a Oracle Database Server:
1) ORA-12154: TNS:could not resolve the connect identifier specified: When there is an issue in TNSNAMES.ORA like connect identifier entry for “ORCL” is not existing or proper in TNSNAMES.ORA.
2) ORA-12545: Connect failed because target host or object does not exist: “ngarg.mydomain.co.in” can not be reached over the network.
3) ORA-12541: TNS:no listener: There is no listener running on “ngarg.mydomain.co.in”
4) ORA-12560: TNS:protocol adapter error: There is no listener running on “ngarg.mydomain.co.in” at port 1521, or listener not properly configured.
5) ORA-12514: TNS:listener does not currently know of service requested in connect descriptor: Listener is running but is not configured for the service “orcl.mydomain.co.in”

Advertisements
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: