Sunday, November 02, 2008

A single listener with multiple listening addresses

- Modified listener.ora file.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1529))
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
)
)


- Added alias name in tnsnames.ora file on the same location listener.ora file.

TESTLISTENER=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost )(PORT = 1529))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost )(PORT = 1521))
)

- altered LOCAL_LISTENER parameter to alias name.

SQL> ALTER SYSTEM SET LOCAL_LISTENER='TESTLISTENER' SCOPE=BOTH;

System altered.

- stopped / started listener.

$ lsnrctl stop

$ lsnrctl start

$ lsnrctl status

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 02-NOV-2008 02:50:58

Copyright (c) 1991, 2007, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1529)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date 02-NOV-2008 02:49:00
Uptime 0 days 0 hr. 1 min. 58 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File ORACLE_HOME/network/admin/listener.ora
Listener Log File ORACLE_HOME/log/diag/tnslsnr/hostname/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)(PORT=1529)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)(PORT=1521)))
Services Summary...
Service "db" has 1 instance(s).
Instance "db", status READY, has 1 handler(s) for this service...
Service "db2XDB" has 1 instance(s).
Instance "db", status READY, has 1 handler(s) for this service...
Service "db_XPT" has 1 instance(s).
Instance "db", status READY, has 1 handler(s) for this service...
The command completed successfully

- Tested multiple listening addresses.

SQL> conn scott@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=db)))
Enter password:
Connected.

SQL> conn scott@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1529))(CONNECT_DATA=(SID=db)))
Enter password:
Connected.

.
.
.

No comments: