文档章节

怎样启动、关闭和重新启动oracle监听器 in linux

Rebecca_Hu
 Rebecca_Hu
发布于 2013/08/09 12:28
字数 1981
阅读 414
收藏 5

行业解决方案、产品招募中!想赚钱就来传!>>>

对于DBA来说,启动和关闭oracle监听器是很基础的任务,但是Linux系统管理员或者程序员有时也需要在开发数据库中做一些基本的DBA操作,因此了解一些基本的管理操作对他们来说很重要。

      本文将讨论用LSNRCTL命令启动、关闭和查看监听器的状态的方法。

怎样启动、关闭和重新启动oracle监听器

在启动、关闭或者重启oracle监听器之前确保使用lsnrctl status命令检查oracle监听器的状态。除了得到监听器的状态之外,你还可以从lsnrctl status命令的输出中得到如下的信息:

监听器的启动时间
监听器的运行时间
监听器参数文件listener.ora的位置,通常位于$ORACLE_HOME/network/admin目录下
监听器日志文件的位置
如果oracle监听器没用运行,你将得到如下的信息

view plaincopy to clipboardprint?
$ lsnrctl status  

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:39  

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))  
TNS-12541: TNS:no listener  
TNS-12560: TNS:protocol adapter error  
TNS-00511: No listener  
Linux Error: 111: Connection refused  
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))  
TNS-12541: TNS:no listener  
TNS-12560: TNS:protocol adapter error  
TNS-00511: No listener  
Linux Error: 2: No such file or directory
$ lsnrctl status

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:39

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directory

 

如果oracle监听器正在运行,你将得到如下信息

view plaincopy to clipboardprint?
$ lsnrctl status  

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:02  

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))  
STATUS of the LISTENER  
————————  
Alias                     LISTENER  
Version                   TNSLSNR for Linux: Version 11.1.0.6.0 - Production  
Start Date                29-APR-2009 18:43:13  
Uptime                    6 days 21 hr. 43 min. 49 sec  
Trace Level               off  
Security                  ON: Local OS Authentication  
SNMP                      OFF  
Listener Parameter File   /u01/app/oracle/product/11.1.0/network/admin/listener.ora  
Listener Log File         /u01/app/oracle/diag/tnslsnr/devdb/listener/alert/log.xml  
Listening Endpoints Summary…  
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.2)(PORT=1521)))  
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))  
Services Summary…  
Service “devdb” has 1 instance(s).  
Instance “devdb”, status UNKNOWN, has 1 handler(s) for this service…  
Service “devdb.thegeekstuff.com” has 1 instance(s).  
Instance “devdb”, status READY, has 1 handler(s) for this service…  
Service “devdbXDB.thegeekstuff.com” has 1 instance(s).  
Instance “devdb”, status READY, has 1 handler(s) for this service…  
Service “devdb_XPT.thegeekstuff.com” has 1 instance(s).  
Instance “devdb”, status READY, has 1 handler(s) for this service…  
The command completed successfully
$ lsnrctl status

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:02

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
STATUS of the LISTENER
————————
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date                29-APR-2009 18:43:13
Uptime                    6 days 21 hr. 43 min. 49 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.1.0/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/devdb/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.2)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary…
Service “devdb” has 1 instance(s).
Instance “devdb”, status UNKNOWN, has 1 handler(s) for this service…
Service “devdb.thegeekstuff.com” has 1 instance(s).
Instance “devdb”, status READY, has 1 handler(s) for this service…
Service “devdbXDB.thegeekstuff.com” has 1 instance(s).
Instance “devdb”, status READY, has 1 handler(s) for this service…
Service “devdb_XPT.thegeekstuff.com” has 1 instance(s).
Instance “devdb”, status READY, has 1 handler(s) for this service…
The command completed successfully

2.启动oracle监听器

如果oracle监听器没用运行,你可以用lsnrctl start命令启动oracle监听器,该命令将启动所有的监听器,如果你只想启动特定的监听器,可以再start后面指定监听器的名字,例如:lsnrctl start [listener-name]。

view plaincopy to clipboardprint?
$ lsnrctl start  

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:42  

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

Starting /u01/app/oracle/product/11.1.0/bin/tnslsnr: please wait…  

TNSLSNR for Linux: Version 11.1.0.6.0 - Production  
System parameter file is /u01/app/oracle/product/11.1.0/network/admin/listener.ora  
Log messages written to /u01/app/oracle/diag/tnslsnr/devdb/listener/alert/log.xml  
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.2)(PORT=1521)))  
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))  

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))  
STATUS of the LISTENER  
————————  
Alias                     LISTENER  
Version                   TNSLSNR for Linux: Version 11.1.0.6.0 - Production  
Start Date                04-APR-2009 16:27:42  
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.1.0/network/admin/listener.ora  
Listener Log File         /u01/app/oracle/diag/tnslsnr/devdb/listener/alert/log.xml  
Listening Endpoints Summary…  
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.2)(PORT=1521)))  
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))  
Services Summary…  
Service “devdb” has 1 instance(s).  
Instance “devdb”, status UNKNOWN, has 1 handler(s) for this service…  
The command completed successfully
$ lsnrctl start

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:42

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

Starting /u01/app/oracle/product/11.1.0/bin/tnslsnr: please wait…

TNSLSNR for Linux: Version 11.1.0.6.0 - Production
System parameter file is /u01/app/oracle/product/11.1.0/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/devdb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.2)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
STATUS of the LISTENER
————————
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date                04-APR-2009 16:27:42
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.1.0/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/devdb/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.2)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary…
Service “devdb” has 1 instance(s).
Instance “devdb”, status UNKNOWN, has 1 handler(s) for this service…
The command completed successfully

3.关闭oracle监听器

如果oracle监听器正在运行,可以使用lsnrctl stop命令关闭oracle监听器,该命令将关闭所有的监听器,如果你只想关闭特定的监听器,可以再stop后面指定监听器的名字,例如:lsnrctl stop [listener-name]

view plaincopy to clipboardprint?
$ lsnrctl stop  

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:37  

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))  
The command completed successfully
$ lsnrctl stop

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:37

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
The command completed successfully

4.重启oracle监听器

用lsnrctl reload重启监听器,此命令可以代替lsnrctl stop和lsnrctl start。重启将会在不需要关闭和启动监听器的情况下读取listener.ora的配置。

view plaincopy to clipboardprint?
$ lsnrctl reload  

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 17:03:31  

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))  
The command completed successfully
$ lsnrctl reload

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 17:03:31

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
The command completed successfully

Oracle监听器帮助

1.查看所有的监听器命令

lsnrctl hep命令可以显示所有可用的监听器命令。在oracle11g中其输出如下:

start - Start the Oracle listener
stop - Stop the Oracle listener
status - Display the current status of the Oracle listener
services - Retrieve the listener services information
version - Display the oracle listener version information
reload - This will reload the oracle listener SID and parameter files. This is equivalent to lsnrctl stop and lsnrctl start.
save_config - This will save the current settings to the listener.ora file and also take a backup of the listener.ora file before overwriting it. If there are no changes, it will display the message “No changes to save for LISTENER”
trace - Enable the tracing at the listener level. The available options are ‘trace OFF’, ‘trace USER’, ‘trace ADMIN’ or ‘trace SUPPORT’
spawn - Spawns a new with the program with the spawn_alias mentioned in the listener.ora file
change_password - Set the new password to the oracle listener (or) change the existing listener password.
show - Display log files and other relevant listener information.
view plaincopy to clipboardprint?
$ lsnrctl help  

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:12:09  

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

The following operations are available  
An asterisk (*) denotes a modifier or extended command:  

start               stop                status  
services            version             reload  
save_config         trace               spawn  
change_password     quit                exit  
set*                show*
$ lsnrctl help

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:12:09

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

The following operations are available
An asterisk (*) denotes a modifier or extended command:

start               stop                status
services            version             reload
save_config         trace               spawn
change_password     quit                exit
set*                show*

2.得到指定监听器命令的详细帮助信息

可以使用lsnrctl help得到指定的命令的详细帮助信息。如下所示

view plaincopy to clipboardprint?
$ lsnrctl help show  

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:22:28  

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

The following operations are available after show  
An asterisk (*) denotes a modifier or extended command:  

rawmode                     displaymode  
rules                       trc_file  
trc_directory               trc_level  
log_file                    log_directory  
log_status                  current_listener  
inbound_connect_timeout     startup_waittime  
snmp_visible                save_config_on_stop  
dynamic_registration

Rebecca_Hu
粉丝 23
博文 111
码字总数 16440
作品 0
武汉
QA/测试工程师
私信 提问
加载中
请先登录后再评论。
我的架构演化笔记 功能1: 基本的用户注册

“咚咚”,一阵急促的敲门声, 我从睡梦中惊醒,我靠,这才几点,谁这么早, 开门一看,原来我的小表弟放暑假了,来南京玩,顺便说跟我后面学习一个网站是怎么做出来的。 于是有了下面的一段...

强子哥哥
2014/05/31
976
3
树莓派(Raspberry Pi):完美的家用服务器

自从树莓派发布后,所有在互联网上的网站为此激动人心的设备提供了很多有趣和具有挑战性的使用方法。虽然这些想法都很棒,但树莓派( RPi )最明显却又是最不吸引人的用处是:创建你的完美家用...

异次元
2013/11/09
6.6K
8
TDD的测试框架--Machine.Specification

Machine.Specification 是一个 TDD 测试驱动开发的测试框架,简化了测试,无需关心语言本身特性。 Machine.Specifications 带来的好处是不需要在代码里有注释,但同时阅读代码的人可以一目了...

匿名
2013/01/22
1.1K
0
Linux 反汇编工具--LDasm

LDasm (Linux 反汇编工具) 是一个基于 Perl/TK 的 objdump/binutils 图形化工具,试图模仿 W32Dasm 工具的外观。可搜索相互参照,将代码从 GAS 转换成 MASM 风格代码等等。...

匿名
2013/01/22
5.5K
1
mvc框架--Razor

Razor 是一个轻巧而优雅的servlet mvc框架 # 又一个轮子? no,写就她是为了证实我个人的某些想法,并在这个过程中练练手,这两种冲动碰撞在一起,自然而然地产生了Razor # Razor的现在和未来...

dtubest
2013/01/25
3.1K
0

没有更多内容

加载失败,请刷新页面

加载更多

以渠道身份为数据背书,悟空榜如何呈现最真实的市场声音?

文 | 曾响铃 来源 | 科技向令说(xiangling0815) 时至今日,电商节已经成为各巨头零售平台例行的活动,花样在不断创新,玩法也在不断涌现。 在这个过程中,伴随电商节的各种品牌、产品销量榜...

曾响铃
前天
0
0
川普宣布拉黑微信支付!腾讯市值一度蒸发5000亿,45天后跟鹅厂发生交易都属违法

郭一璞 发自 凹非寺 量子位 报道 | 公众号 QbitAI 轮到腾讯和微信了。 谁都没想到,川普针对中国企业的举措会进展的这么快,就在刚刚,白宫官方网站po出一条总统行政命令: Executive Order ...

Java旅途
昨天
0
0
图解浏览器安全(同源策略、XSS、CSRF、跨域、HTTPS、安全沙箱等串成糖葫芦)

关注公众号“执鸢者”,获取大量教学视频并进入专业交流群,回复“安全”获取本节思维导图。 一天小林又去面试啦,面试官说:“小林呀,你对浏览器安全了解多少?”。小林摸了摸头说,目前我...

执鸢者
昨天
0
0
《乘风破浪的姐姐》:内容营销研究报告

《乘风破浪的姐姐》节目表现 大盘:同期热播的综艺中,《乘风破浪的姐姐》全面领先 6月12号以来,同期热播的综艺节目《乘风破浪的姐姐》播映指数排名第一,整体热度相对靠前;好评度、观看度等...

OSC_BMKOlH
昨天
0
0
TikTok遭遇十面埋伏的BGM,是美国Z时代人的抗议声 | 一周之最

原本是来中国街头吃吃吃,积累了不少粉丝的老外博主郭杰瑞,不知是不是因为央视的连线,顺应时势地变成了时政UP主,因疫情回到美国后,一直带着口罩在街头做采访,满足中国网友各种好奇。 从...

紫金山科技
前天
0
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部