一、手动配置监听
1、查看当前系统参数信息
[oracle@OL541 admin]$ hostname
OL541.localdomain
[oracle@OL541 admin]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
SYS@orcl>show parameter name
NAME TYPE VALUE
------------------ ----------- ----------
db_name string orcl
db_unique_name string orcl
global_names boolean FALSE
instance_name string orcl
service_names string orcl
cd $ORACLE_HOME/network/admin
[oracle@OL541 admin]$ cd /u01/app/oracle/product/11.2.0/db_1/network/admin/
[oracle@OL541 admin]$ ll
total 16
drwxr-xr-x 2 oracle oinstall 4096 Feb 3 14:47 samples
-rw-r--r-- 1 oracle oinstall 205 May 11 2011 shrept.lst
2、创建默认监听
[oracle@OL541 admin]$ vi listener.ora
LISTENER=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=OL541.localdomain)(PORT=1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=orcl)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME=orcl))
(SID_DESC=
(SID_NAME=plsextproc)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(PROGRAM=extproc)))
启动监听
[oracle@OL541 ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 06-FEB-2015 10:49:59
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/OL541/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=OL541.localdomain)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=OL541.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 06-FEB-2015 10:49:59
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/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/OL541/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=OL541.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", 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@OL541 ~]$
3、创建一个非默认监听,监听名为lsnr2,端口号为1621,key为extproc1;
listener.ora中添加内容:
LSNR2=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=OL541.localdomain)(PORT=1621))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1))))
将orcl实例注册到监听lsnr2中;
SYS@orcl>show parameter local
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string
SQL>alter system set local_listener='(ADDRESS = (PROTOCOL=TCP)(HOST=OL541.localdomain)(PORT=1621))';
启动lsnr2
[oracle@OL541 ~]$ lsnrctl start lsnr2
[oracle@OL541 ~]$ lsnrctl status
如看lsnr2服务oracle进程,则需要在系统中重新注册一下
sql》alter system register;
4、启动关闭监听
启动默认监听:
lsnrctl start
启动lsnr2
lsnrctl start lsnr2
停止默认监听:
lsnrctl stop
停止lsnr2
lsnrctl stop lsnr2
查看监听状态
lsnrctl status
lsnrctl status lsnr2
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29519108/viewspace-1428489/,如需转载,请注明出处,否则将追究法律责任。