天天看點

linux tns12541無監聽程式,TNS-12541: TNS: 無監聽程式與TNS-12560: TNS: 協定擴充卡錯誤...

一、環境描述:

OS : Windows Server 2008 32Bit

DB : Oracle 11.2.0

二、排錯過程:

前天應用不能通路Oracle資料庫了 (背景應用能通路資料庫),故障發生。

馬上登入到伺服器裡檢視監聽狀态,發現有TNS-12541 ,TNS-12560等錯誤

手動把監聽服務啟動,這時候服務狀态上顯示為已啟動,但在CMD視窗執行lsnrctl status的時候依然傳回錯誤資訊:

C:\>lsnrctl status

LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 13-2月 -2018 10:39:47

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

正在連接配接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=john-PC)(PORT=

TNS-12541: TNS: 無監聽程式

TNS-12560: TNS: 協定擴充卡錯誤

TNS-00511: 無監聽程式

32-bit Windows Error: 61: Unknown error

正在連接配接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))

過段時間回顯非常慢。

三、解決方案步驟

**網上有個解決TNS-12535錯誤的案例,平台和版本都很類似,如下:

1、在 sqlnet.ora檔案中 增加如下行:

DIAG_ADR_ENABLED = OFF

linux tns12541無監聽程式,TNS-12541: TNS: 無監聽程式與TNS-12560: TNS: 協定擴充卡錯誤...

2、在listener.ora檔案中增加如下行:

DIAG_ADR_ENABLED_ = OFF

如果監聽是listener時,則前面的名稱為:DIAG_ADR_ENABLED_LISTENER = OFF

linux tns12541無監聽程式,TNS-12541: TNS: 無監聽程式與TNS-12560: TNS: 協定擴充卡錯誤...

3、重新啟動windows服務管理中的監聽程式.先停止,然後再重新啟動.

4、檢查結果.發現可以了,傳回的值在10毫秒.有時為0毫秒.成功!!

但這并不是問題發生原因,在繼續排查過程中偶然發現監聽日志大小居然為4G。

Oracle一個BUG,BUG号為9879101 : THE CONNECT THROUGH LISTENER WAS SLOW WHEN LISTNER LOG GROWED 4GB。

有MOS上一篇文章,ID 1319797.1 : WINDOWS: Listener Hangs & Lsnrctl Commands Are Slow or Hang,裡面給出了解決方法:

You can solve this problem by deleting the large listener in $ORACLE_BASE\diag\tnslsnr\\listener\trace\.log

1)  Stop the listener process using the command line or Control Panel Service.

2) Delete the log file(s) that are at or approaching the 4G size limit at this location:

$ORACLE_BASE\diag\tnslsnr\\listener\trace\.log

3)  Issue any lsnrctl command and you will see a new listener.log in its place under:

$ORACLE_BASE\diag\tnslsnr\\listener\trace\

Since ADR Diagnostics are enabled for this listener these steps cannot be done dynamically using the lsnrctl utility.

e.g.

LSNRCTL>set log_file mylog

Will yield:  TNS-01251: Cannot set trace/log directory under ADR.

However, it is possible to disable the flat file listener logging using the following commands:

LSNRCTL>set current_listener

LSNRCTL>set log_status OFF

LSNRCTL>save_config

5、按照以上說明如下進行:

1)LSNRCTL進入互動模式

2)set log_file mylog

3)執行set current_listener LISTENER

4)set log_status off

5)save_config

6)stop 停止監聽器

7)手工删除ADR指定的監聽日志路徑下的listener.log檔案

8)start重新開機監聽器

9)status檢視狀态