One listener for more databases:
LISTENER=
(DESCRIPTION=
(ADDRESS=(HOST=localhost)(PROTOCOL=tcp)(PORT=1521))
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=ocm11g)
(ORACLE_HOME=/oracle/product/11.2.0/dbhome_1)
)
(SID_DESC=
(SID_NAME=ocm11g)
(ORACLE_HOME=/oracle/product/10.2.0/dbhome_1)
)
)
One listener for each database.
LISTENER=
(DESCRIPTION=
(ADDRESS=(HOST=localhost)(PROTOCOL=tcp)(PORT=1521))
)
LISTENER_1=
(DESCRIPTION=
(ADDRESS=(HOST=localhost)(PROTOCOL=tcp)(PORT=1522))
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=ocm11g)
(ORACLE_HOME=/oracle/product/11.2.0/dbhome_1)
)
)
SID_LIST_LISTENER_1=
(SID_LIST=
(SID_DESC=
(SID_NAME=ocm10g)
(ORACLE_HOME=/oracle/product/10.2.0/dbhome_1)
)
)
[oracle@ocm11g admin]$ lsnrctl start listener
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 23-AUG-2011 10:14:40
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Starting /oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.2.0 - Production
System parameter file is /oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /oracle/diag/tnslsnr/ocm11g/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm11g.localdomain)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(HOST=localhost)(PROTOCOL=tcp)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias listener
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 23-AUG-2011 10:14:40
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/diag/tnslsnr/ocm11g/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm11g.localdomain)(PORT=1521)))
Services Summary...
Service "ocm11g" has 1 instance(s).
Instance "ocm11g", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@ocm11g admin]$ lsnrctl start listener_1
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 23-AUG-2011 10:16:49
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Starting /oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.2.0 - Production
System parameter file is /oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /oracle/diag/tnslsnr/ocm11g/listener_1/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm11g.localdomain)(PORT=1522)))
Connecting to (DESCRIPTION=(ADDRESS=(HOST=localhost)(PROTOCOL=tcp)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias listener_1
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 23-AUG-2011 10:16:50
Uptime 0 days 0 hr. 0 min. 1 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/diag/tnslsnr/ocm11g/listener_1/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm11g.localdomain)(PORT=1522)))
Services Summary...
Service "ocm10g" has 1 instance(s).
Instance "ocm10g", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@ocm11g admin]$ ps -aef|grep tns
oracle 4568 1 0 10:14 ? 00:00:00 /oracle/product/11.2.0/dbhome_1/bin/tnslsnr listener -inherit
oracle 4582 1 0 10:16 ? 00:00:00 /oracle/product/10.2.0/dbhome_1/bin/tnslsnr listener_1 -inherit
2. tnsnames.ora for multiple databases
ocm11g=
(DESCRIPTION=
(ADDRESS=(HOST=localhost)(PROTOCOL=tcp)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=ocm11g)
)
)
ocm10g=
(DESCRIPTION=
(ADDRESS=(HOST=localhost)(PROTOCOL=tcp)(PORT=1522))
(CONNECT_DATA=
(SERVICE_NAME=ocm10g)
)
)
ocm11g_cman=
(DESCRIPTION=
(ADDRESS=(localhost)(PROTOCOL=tcp)(PORT=1630))
(ADDRESS=(localhost)(PROTOCOL=tcp)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=ocm11g))
)
[oracle@ocm11g admin]$ tnsping ocm11g
TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 23-AUG-2011 10:25:45
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS=(HOST=localhost)(PROTOCOL=tcp)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=ocm11g)))
OK (70 msec)
[oracle@ocm11g admin]$ tnsping ocm10g
TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 23-AUG-2011 10:25:58
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS=(HOST=localhost)(PROTOCOL=tcp)(PORT=1522)) (CONNECT_DATA=(SERVICE_NAME=ocm10g)))
OK (10 msec)
[oracle@ocm11g admin]$ tnsping ocm11g_cman
TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 23-AUG-2011 10:28:17
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS=(HOST=localhost)(PROTOCOL=tcp)(PORT=1630)) (ADDRESS=(HOST=localhost)(PROTOCOL=tcp)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=ocm11g)))
OK (100 msec)