mert inan
mert inan

Reputation: 1597

how is connection to oracle established?

My oracle tns listener is listening on 1521 and I have got 2 live connections. Could you please explain how the connections are established to 127.0.0.1:1521? Is tnslistener passing connection to oracleXE? Is it something to do with this Can I open a socket and pass it to another process in Linux?

Proto Recv-Q Send-Q Local Address           Foreign Address         State          PID/Program name
tcp        0      0 0.0.0.0:1521            0.0.0.0:*               LISTEN         1129/tnslsnr    
tcp        0      0 127.0.0.1:1521          127.0.0.1:37542         ESTABLISHED 9091/oracleXE   
tcp        0      0 127.0.0.1:1521          127.0.0.1:37975         ESTABLISHED 9907/oracleXE   
tcp        0      0 127.0.0.1:37975         127.0.0.1:1521          ESTABLISHED 9905/sqlplus    
tcp        0      1 192.168.0.7:41844       10.20.12.63:1521        SYN_SENT    1155/xe_pmon_XE 
tcp        0      0 127.0.0.1:37542         127.0.0.1:1521          ESTABLISHED 9089/sqlplus 

Update: And also there is no parent/child relation bettwen those

F S UID        PID  PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY          TIME CMD
0 S oracle    9091     1  0  80   0 - 217645 sk_wai 17:16 ?       00:00:00 oracleXE (LOCAL=NO)
0 S oracle    9907     1  0  80   0 - 217645 sk_wai 17:43 ?       00:00:00 oracleXE (LOCAL=NO)
0 S oracle    1129     1  0  80   0 -  5529 poll_s 08:27 ?        00:00:00 /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/tnslsnr LISTENER -inherit

Upvotes: 0

Views: 848

Answers (1)

user123664
user123664

Reputation:

The listener listens to the listener port. There it accepts a connection, checks the CONNECT_DATA and decides to hand over the session to the specified ORACLE_SID or ORACLE_SERVICE, if that is registered with the listener. The hand over normally is to a different process and a different port. This port number is returned to the client and the client will communicate to the ORACLE process using that port. In a RAC system, the host can be a different one too. If load balancing is enabled the session is routed to the least loaded instance and that can be on a different host than where the original request landed.

If the listener is down, new connection can not be made but existing session can be used.

Upvotes: 2

Related Questions