[oracle@ocm1 admin]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-MAR-2014 12:05:33
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 18-MAR-2014 12:05:33
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
Service "EMREP" has 1 instance(s).
Instance "EMREP", status UNKNOWN, has 1 handler(s) for this service...
Service "PROD" has 1 instance(s).
Instance "PROD", status UNKNOWN, has 1 handler(s) for this service...
Service "plsextproc" has 1 instance(s).
Instance "plsextproc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@ocm1 admin]$
[oracle@ocm1 admin]$ vi listener.ora
LISTENER=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=PROD)
(ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)
(SID_NAME=PROD))
(SID_DESC=
(GLOBAL_DBNAME=EMREP)
(ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)
(SID_NAME=EMREP))
(SID_DESC=
(SID_NAME=plsextproc)
(ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)
(PROGRAM=extproc)))
LSNR2=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1))))
~
~
~
~
"listener.ora" 25L, 712C written
2.2.1 Set up the PROD instance to automatically register with the LSNR2.
将PROD实例自动注册到LSNR2。
SQL> conn /as sysdba
Connected.
SQL>
SQL> show parameter local
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string
log_archive_local_first boolean TRUE
参考联机文档:
Reference ==> LOCAL_LISTENER参数
http://docs.oracle.com/cd/B19306_01/server.102/b14237/initparams095.htm#i1128493
LOCAL_LISTENER
LOCAL_LISTENER
specifies a network name that resolves to an address or address list of Oracle Net local listeners (that is, listeners that are running on the same machine as this instance). The address or address list is specified in the TNSNAMES.ORA
file or other address repository as configured for your system.
SQL> alter system set local_listener='(ADDRESS = (PROTOCOL=TCP)(HOST=ocm1.localdomain)(PORT=1526))';
System altered.
SQL> show parameter local
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string (ADDRESS = (PROTOCOL=TCP)(HOST
=ocm1.localdomain)(PORT=1526))
log_archive_local_first boolean TRUE
SQL>
[oracle@ocm1 ~]$ lsnrctl status lsnr2
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-MAR-2014 13:01:03
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))
STATUS of the LISTENER
------------------------
Alias lsnr2
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 18-MAR-2014 12:31:26
Uptime 0 days 0 hr. 29 min. 36 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/lsnr2.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1)))
Services Summary...
Service "PROD" has 1 instance(s).
Instance "PROD", status READY, has 1 handler(s) for this service...
Service "PROD_XPT" has 1 instance(s).
Instance "PROD", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@ocm1 ~]$
- 6.如果此时查不到PROD,则需要在SQL中再注册一下:
[oracle@ocm1 ~]$ lsnrctl status lsnr2
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-MAR-2014 13:02:58
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))
STATUS of the LISTENER
------------------------
Alias lsnr2
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 18-MAR-2014 13:02:09
Uptime 0 days 0 hr. 0 min. 49 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/lsnr2.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1)))
The listener supports no services
The command completed successfully
则在SQL中再注册一下:
SQL> alter system register;
System altered.
再来查看状态:
[oracle@ocm1 ~]$ lsnrctl status lsnr2
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-MAR-2014 13:04:20
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))
STATUS of the LISTENER
------------------------
Alias lsnr2
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 18-MAR-2014 13:02:09
Uptime 0 days 0 hr. 2 min. 11 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/lsnr2.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1)))
Services Summary...
Service "PROD" has 1 instance(s).
Instance "PROD", status READY, has 1 handler(s) for this service...
Service "PROD_XPT" has 1 instance(s).
Instance "PROD", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@ocm1 ~]$
2.3 Start both listeners.
之前两个监听都已经启动。