woensdag 20 juni 2012

Oracle Listener

Oracle Default Listener

Prior to Oracle 8i, a listener was statically configured (listener.ora) to service a given set of SIDs. From 8i, PMON dynamically registers a database service with the listener.Further, if the listener is running on the default TCP port of 1521, then there is no need to configure a listener.ora at all.


USING A DEFAULT LISTENER
A listener.ora file is not required in order to use the default listener.
The listener is started in the conventional manner:
$lsnrctl start
This listener will listen on two addresses:
   (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY))
   (ADDRESS=(PROTOCOL=tcp)(PORT=1521))

In order to change parameters to non default values (such as enabling listener tracing), a listener.ora should be created with the relevant parameters specified. The listener then needs to be restarted.
By default, PMON will register the database service with the listener on port 1521.

USING A NON DEFAULT LISTENER
When a non-default listener is used, then a listener.ora must be configured with the relevant listener address. For example,

LISTENER =
 (ADDRESS_LIST =
   (ADDRESS = (PROTOCOL=TCP) (HOST=uksn115) (PORT=2500))
 )

This would start a listener on port 2500.
In order for PMON to be able to register the database service(s) with this listener, the init.ora parameter LOCAL_LISTENER must be set.
eg, LOCAL_LISTENER=listener_A
PMON will attempt to resolve LOCAL_LISTENER using some naming method. For example, this may be resolved in tnsnames.ora, as follows:

listener_A =
  (DESCRIPTION =
    (ADDRESS=(PROTOCOL=TCP)(HOST=uksn155)(PORT=2500))
  )

PMON will search for tnsnames.ora in the following order:
  • $HOME/.tnsnames.ora
  • $TNS_ADMIN/tnsnames.ora
  • /var/opt/oracle/tnsnames.ora or /etc/tnsnames.ora (depending on platform)
  • $ORACLE_HOME/network/admin/tnsnames.ora

If a tnsnames.ora cannot be found or if LOCAL_LISTENER cannot be resolved, the alert.log will show:

PMON started with pid=2
Syntax error in listener string

If LOCAL_LISTENER can be resolved, but there is a syntax error in the tnsnames.ora specification, the alert log will show:

PMON started with pid=2
Syntax error in listener string (DESCRIPTION =)

The instance will start regardless of PMON errors during registration, unless MTS is enabled. If MTS enabled, then both of the above error scenarios will give:

ORA-00101: invalid specification for system parameter
MTS_DISPATCHERS

in addition to the relevant alert log message. The instance will not start.
Note that if 'NAMES.DEFAULT_DOMAIN' is set in sqlnet.ora, then the tnsnames.ora entry should be of the form NAME.DOMAIN. The domain will be appended to LOCAL_LISTENER if not already specified.
eg,
init.ora:           LOCAL_LISTENER=listener_A (or listener_A.uk.oracle.com)
sqlnet.ora:         NAMES.DEFAULT_DOMAIN=uk.oracle.com
tnsnames.ora:       listener_A.uk.oracle.com=(...)

The search order for the 'system' sqlnet.ora is:
  • $TNS_ADMIN/sqlnet.ora
  • $ORACLE_HOME/network/admin/sqlnet.ora
Additionally, the 'local' sqlnet.ora is always read from:
  • $HOME/.sqlnet.ora
If this file exists, then any parameters defined here will override the ones in the 'system' sqlnet.ora.
Note, /etc or /var/opt/oracle is not searched for the 'system' sqlnet.ora unless TNS_ADMIN happens to be set to this directory.

Geen opmerkingen:

Een reactie posten