Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
cancel
Showing results for 
Search instead for 
Did you mean: 

oracle listener question

Aashish Raj
Valued Contributor

oracle listener question

Hi,

I am trying to find out how oracle listener works.My understandning is that when a request comes to listener, listener will fork and executesoracle{ORACLE_SID} process which will send itsport to the client process.So now all the request for that client will come to this port instead of listener port(1521).That is why even if i shutdown the listener now, the existing connection will not be impacted.

I am not able to confirm this with netstat -an command.What i see just the connectionbetween
Host.port and client.port where port for database server is always 1521(listener port).

am i misinterpreting this.

Thanks !
12 REPLIES
Tore_1
Regular Advisor

Re: oracle listener question

Try lsof -i:1521

or UNIX95=1 ps -eflH | more which will show processes in hierarchy so that you can verify which processes follow the listener process.

Or tusc -p PID. where PID=listenerpid. Include
the "follow forks" option.

Steven Gillard_2
Honored Contributor

Re: oracle listener question

You're absolutely correct. All the listener does is accept the connection and fork an oracle server process for the requested instance. Once the connection is established all communication occurs directly between the client and the server process over the TCP socket using the net*8 protocol.

If the listener is not running you will not be able to establish new connections but existing ones will be unaffected.

As Tore suggested the 'tusc' utility is great for giving you an idea how things work.

Regards,
Steve
Printaporn_1
Esteemed Contributor

Re: oracle listener question

Hi,

you're right following from Net8 admin guide:
1. The listener is started and listens on an address specified in a listener
configuration file.
2. The listener then spawns a series of dedicated server processes until it reaches
the specified pool size defined in its configuration file.
3. Each spawned server process performs a partial address listen and provides the
listener with the partial address that it is listening on. The listener initially
marks all prespawned servers as idle.
4. The client sends a connect request to the listener.
5. The listener receives the network session request, and determines if the client???s
request may be serviced. If not, the listener refuses the network session and
then resumes at Step 9.
6. The listener issues a redirect message to the client containing one of the
network addresses of the prespawned servers. The listener logs that server as
active.
7. The client dissolves the network session to the listener and establishes a
network session to the prespawned server using the address provided in the
redirect message.
8. The listener spawns another server process to replace the active prespawned
server (provided a value called PRESPAWN_MAX in the listener configuration
file is greater than the number of prespawned server processes active and idle).
9. The listener continues listening for incoming network sessions.
enjoy any little thing in my life
Steven Gillard_2
Honored Contributor

Re: oracle listener question

OK a bit of conflicting information... both are correct, it actually depends on whether you are using MTS (multi-threaded server) or not. I described the dedicated server connection method above, where each client has its own server process. If you're using MTS (as printaporn described) the dispatcher becomes involved and it is a little more complicated because server processes handle multiple client connections.

Here's a link to the part of the Net*8 admin guide that describes this:

http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/network.817/a76933/concepts.htm#1011542

Regards,
Steve
Andreas D. Skjervold
Honored Contributor

Re: oracle listener question

Hi

Due to this port redirection you have to be aware when planning connections thru a firewall.
You have to use compatible Firewall software that can handle this or use Oracle Connection Manager.

rgds
Andreas

Hei Tore, hyggelig med flere nordmenn her...
Only by ignoring what everyone think is important, can you be aware of what everyone ignores!
Aashish Raj
Valued Contributor

Re: oracle listener question

Thanks for all the prompt replies.

I agree with you but my question is why
netstat -an does not show me the connection
Dbserver.redirected_port <--> client.port

What it does shows is
Dbserver.listener_port <--> client.port

Thanks a lot !

PS :I will assign points later
Tom Danzig
Honored Contributor

Re: oracle listener question

On our Oracle servers, netstat shows the established SQLNet connections listed as such:

tcp 0 0 hostname.1748 10.2.21.57.4459 ESTABLISHED
Aashish Raj
Valued Contributor

Re: oracle listener question

Hi,

Which oracle version u are using.
I am using oracle 817 and what i see is all the connection from sqlnet client have a socket open at listener port(1521).This is the only socket opened by these sqlnet client.

Am i missing something .I am using netstat -an command to get the list of sockets.

Thanks
Steven Gillard_2
Honored Contributor

Re: oracle listener question

This is normal, especially if you are using a dedicated server configuration. In the MTS case, the documentation talks about the 'direct hand-off' if the dispatcher and listener are local (running on the same system). In this situation the original TCP connection is used in communication between the client and dispatcher, which also explains what you are seeing.

Please have a good read of the relevant section of the Net8 admin guide (see the link in my previous post).

Regards,
Steve
Eric Z
Occasional Advisor

Re: oracle listener question

netstat shows the actual connections status.

As in Andreas' case, there was no re-directed port.
There are enough explaination previously.

--Eric
Eric Z
Occasional Advisor

Re: oracle listener question

My bad. I meant Aashish Raj's case, not Andreas'.

I do have a question for Andreas, as he mentioned connection through firewall.
Where can I find relevant articles? Thanks.
harry d brown jr
Honored Contributor

Re: oracle listener question

Aashish,

netstat is a childs toy compared to "lsof".

http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.61/

live free or die
harry
Live Free or Die