As i said in my earlier post it is possible to have multiple listeners in listener.ora and we can specify multiple listeners in listeners in listener.ora file as shown

LISTENER1 =
( ADDRESS_LIST =
(ADDRESS = ( PROTOCOL = IPC ) ( KEY = ORCL ) )
(ADDRESS = (PROTOCOL = TCP)(HOST = dan.us.oracle.com)(PORT = 1521))
)

(SID_LIST_LISTENER1 =
(SID_DESC = (SID_NAME = ORCL)
)

LISTENER2 =
(ADDRESS = (PROTOCOL = TCP)(HOST = dan.us.oracle.com)(PORT = 1522))
(SID_LIST_LISTENER2 =
(SID_DESC = (SID_NAME = ORCL)
)

Here, listener1 and listener2 are the two listeners listening for the same database orcl.It is possible to have 2 listeners on the same system because both the listeners listens on two different ports (port 1521 and port 1522).Multiple listeners for the same database can be used for load balancing to some extent but it generally advisable to use single listener for all the database that resides in the same system.

 

Configuring Database Listeners

On March 20, 2007, in oracle, by admin

Hi all,

Each database requires a listener to receive client requests to connect to the database.Listener can be configured to listen at any given port using any given protocol and this configuration information is stored in listener.ora file.The most common and default configuration for oracle database listeners is port 1521 and TCP protocol.The listener.ora file is found in $ORACLE_HOME/network/admin/listener.ora location.Also, a database can have multiple listeners listening at different port and multiple database can have a single listener listening at single port.The database for which listener must listen can be statically registered in the listener.ora or else it gets dynamically registered .In case of multiple listeners their names and addresses on the machine on which they reside must be unique.

Types of Connection Requests:
=============================

When a connection request is made by a client to a server, the connection can
be made by in of three ways: a bequeath session, a redirect session to a
prespawned dedicated server process, or a redirect session to a dispatcher
multithreaded server. The type of connection is transparent to the user.

1. In a bequeath session, the listener spawns a dedicated server process and passes or bequeaths the connection request to the server process. The listener and the server must exist on the same node, and the operating system or protocol must allow a connection to pass between two different processes on the same machine. A bequeath session starts when a client connects to a listener. The listener determines whether or not the request can be serviced. The listener refuses a connection request if the requested server is not known or unavailable. If the listener agrees to service the connection request, it spawns a new
dedicated server process to serve the incoming session. Next, the listener bequeaths the session to the newly spawned dedicated server process. A session is established between the client and the dedicated server process and data flows directly between the client and the dedicated server process. Meanwhile, the listener continues to listen for other incoming session requests.When the client disconnects from the server, the dedicated server process associated with the client also terminates. The bequeath method uses less system resources in comparison to the other methods of processing client connection requests. If a dedicated
server does not have any prespawned server processes, bequeath is the default method.

2. A listener can also process an incoming connection request by using a redirect session to a dedicated server process. You need to set the PRESPAWN_MAX parameter in the LISTENER.ORA file. This defines the maximum number of prespawned server processes that can exist at a time. The redirect session to a dedicated server process reduces the connection time but uses more system resources. When the listener is started and the dedicated server processes are spawned,a client can request the listener for a connection. If the request is successful, the listener redirects the client request to a prespawned server by issuing a Redirect message with the network address of the prespawned server. When the client receives the Redirect message, it disconnects from the listener and connects to the prespawned server address. A session is established and the listener spawns another dedicated server process to replace the one used by the client. Meanwhile, the listener continues to listen for other incoming sessions.

3. When an Oracle server is configured as a Multi-threaded Server, incoming connection requests are redirected by a listener to a dispatcher process. The dispatcher processes the request by allocating shared server processes to the clients. This enables many clients to connect to the same server without the need to spawn a server process or to have prespawned dedicated server processes. When configured as a Multi-threaded Server and a
database instance is started, dispatchers are started on the basis of the configuration parameters defined in the INIT.ORA. The address of each dispatcher is registered with the listener associated with the database. This helps the listener to monitor the use of each dispatcher and redirect client requests to the least-used dispatcher. The client connects to the listener. The listener receives the connection request and determines whether or not the request can be serviced. If the listener accepts the connection request, it issues a Redirect message to the client containing the network address of the least-used dispatcher for the server. After the client receives the Redirect message, the client disconnects from the listener and connects to the dispatcher address given by the listener. The dispatcher establishes the session with the client and updates the listener with the new load value due to the presence of the new session. The dispatcher also handles the allocation or deallocation of the shared server processes.

SAMPLE LISTENER.ORA

# listener.ora.sskidb1 Network Configuration #File: /oracle/app/oracle/product/10.2.0/sskidb/network/admin/listener.ora.sskidb1
# Generated by Oracle configuration tools.

LISTENER_PHYSDB1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.50.26)(PORT = 1521)(IP = FIRST))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.50.4)(PORT = 1521)(IP = FIRST))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
)
)

SID_LIST_LISTENER_PHYSDB1 =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME = /oracle/app/oracle/product/10.2.0/sharedb)
(SID_NAME = SSKIDB1)
)
(SID_DESC =
(ORACLE_HOME = /oracle/app/oracle/product/10.2.0/sharedb)
(SID_NAME = +ASM1)
)
)

Thanks and Regards

Parikshit