首页 > 应用开发 > IT综合 > Setup two listener.
I. Setting up Two Listeners for one Instance Same Machine
Main
Listener file is located in %ORACE_HOME%networkADMIN directory.
Default listener filename is listener.ora. To add multiple listeners,
listener name, ie
Sample two listeners configuration
Listener.ora
Note: If the listener is expected to handle large volumes of connection request, a parameter QUEUESIZE may be specify. This enables the listener dynamically handle larger numbers of concurrent connection requests. To specify a queue size for a listener, enter a value to the QUEUESIZE parameter at the end of any listening address.
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = zerodefect)(PORT = 1521)(QUEUESIZE=8))
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = O817.zerodefect.us.com)
(ORACLE_HOME = c:oracleora81)
(SID_NAME = O817)
(PRESPAWN_MAX = 0)
)
)
SID_LIST_LISTENER1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = O817.zerodefect.us.com)
(ORACLE_HOME = c:oracleora81)
(SID_NAME = O817)
(PRESPAWN_MAX = 0)
)
)
Start the listeners
At command prompt
C:LSNRCTL start < — — — — — — — — — — – take a default listener file, listener.ora
LSNRCTL for 32-bit Windows: Version 8.1.7.0.0 Production on 09MAR-2005 14:50:32
(c) Copyright 1998 Oracle Corporation. All rights reserved.
Starting tnslsnr: please wait…
TNSLSNR for 32-bit Windows: Version 8.1.7.0.0 – Production
System parameter file is C:OracleOra81networkADMINlistener.ora
Log messages written to C:OracleOra81networkloglistener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=zerodefect.us.com)
(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=zerodefect)(PORT=1521)(QU
EUESIZE=8)))
STATUS of the LISTENER
- — — — — — — — — — – Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 8.1.7.0.0 – Produc
tion
Start Date 09-MAR-2005 14:50:36
Uptime 0 days 0 hr. 0 min. 2 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File C:OracleOra81networkADMINlistener.ora
Listener Log File C:OracleOra81networkloglistener.log
Services Summary…
O817 has 1 service handler(s)
The command completed successfully
C:>lsnrctl start listener1
LSNRCTL for 32-bit Windows: Version 8.1.7.0.0 Production on 09MAR-2005 15:10:
01
(c) Copyright 1998 Oracle Corporation. All rights reserved.
Starting tnslsnr: please wait…
TNSLSNR for 32-bit Windows: Version 8.1.7.0.0 – Production
System parameter file is C:OracleOra81networkADMINlistener.ora
Log messages written to C:OracleOra81networkloglistener1.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=zerodefect.us.com)(PORT=1523)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=zerodefect)(PORT=1523)(QU
EUESIZE=8)))
STATUS of the LISTENER
- — — — — — — — — — — – Alias listener1
Version TNSLSNR for 32-bit Windows: Version 8.1.7.0.0 – Produc
tion
Start Date 09-MAR-2005 15:10:05
Uptime 0 days 0 hr. 0 min. 2 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File C:OracleOra81networkADMINlistener.ora
Listener Log File C:OracleOra81networkloglistener1.log
Services Summary…
O817 has 1 service handler(s)
The command completed successfully
C:>
Check listeners status
C:>lsnrctl stat
LSNRCTL for 32-bit Windows: Version 8.1.7.0.0 Production on 09MAR-2005 14:55:
20
(c) Copyright 1998 Oracle Corporation. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=zerodefect)(PORT=1521)(QU
EUESIZE=8)))
STATUS of the LISTENER
- — — — — — — — — — — – Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 8.1.7.0.0 – Produc
tion
Start Date 09-MAR-2005 14:50:36
Uptime 0 days 0 hr. 4 min. 46 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File C:OracleOra81networkADMINlistener.ora
Listener Log File C:OracleOra81networkloglistener.log
Services Summary…
O817 has 1 service handler(s)
o817 has 2 service handler(s)
The command completed successfully
C:>
II. Setting up Two Listeners for 2 instances Same Machine
It is possible to have two different version of listeners running for 2 different instances. The 2 difference listeners actually running using 2 different port numbers (1521, 1522 or 1523). Later we will Register the instances with the correct listner. Lets take instance 1 as o817 and instance 2 as o9r2, and listner port# as 1521 and 1523 respectively. The listrener name as LISTENER (by default) and LISTENER_9R2 (second listener) The configuration is the same as above but change for LISTENER1 and should look like this:
SID_LIST_LISTENER_9R2 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = O9R2.zerodefect.us.com)
(ORACLE_HOME = c:oracleora9iR2)
(SID_NAME = O9R2)
(PRESPAWN_MAX = 0)
)
)
After that start the listeners.
C:lsnrctl start (listener)
C:lsnrctl start listener_9r2
Then check the status of the listeners
C:lsnrctl stat listener
C:lsnrctl stat listener_9r2
Registering the instance with the correct listener
Starting the O9R2 instance will automatically register itself with the default listener running on port 1521. It should register itself to LISTENER_9R2 running on port 1523.
To make this happen, we have to add and extra line in the database parameter file INITSID.ora. The parameter use in the init file is LOCAL_LISTENER. For detail information about LOCAL_LISTENER, please read the manual, Oracle8i Directory, Networking, and Security – Net8 Administrator Guide.
So to register O9R2 instance to LISTENER_9R2, I add the following line in the INITO9R2.ora file:
LOCAL_LISTENER = “(ADDRESS=(PROTOCOL=TCP)(HOST=zerodefect)(PORT=1523))” -- make sure to put the double quote
After that shutdown/startup the instance to register it to the listener.
In the TNSNAMES.ora file change the port to 1523.
DONE!!!!
[@more@]来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/94317/viewspace-793760/ ,如需转载,请注明出处,否则将追究法律责任。