ORA-12560: TNS: 協議介面卡錯誤的解決方法

oneweaklight發表於2011-07-07

Case:

Microsoft Windows [版本 5.2.3790]
(C) 版權所有 1985-2003 Microsoft Corp.

C:Documents and Settingsuser1>lsnrctl

LSNRCTL for 32-bit Windows: Version 9.2.0.7.0 - Production on 27-8月 -2008 09:33
:43

Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.

歡迎來到LSNRCTL,請鍵入"help"以獲得資訊。

LSNRCTL> status
正在連線到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
TNS-12541: TNS:無監聽器
TNS-12560: TNS: 協議介面卡錯誤
TNS-00511: 無監聽器
32-bit Windows Error: 2: No such file or directory
正在連線到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.55)(PORT=1521)))

TNS-12538: TNS:沒有此協議介面卡
TNS-12560: TNS: 協議介面卡錯誤
TNS-00508: 無此類協議介面卡

LSNRCTL> start
啟動tnslsnr:請稍候...

TNSLSNR for 32-bit Windows: Version 9.2.0.7.0 - Production
系統引數檔案為D:oracleora92networkadminlistener.ora
寫入D:oracleora92networkloglistener.log的日誌資訊
監聽:(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=.pipeEXTPROC1ipc)))
監聽該物件時出錯: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.55)(PORT=
1521)))
TNS-12538: TNS:沒有此協議介面卡
TNS-12560: TNS: 協議介面卡錯誤
TNS-00508: 無此類協議介面卡


監聽程式未能啟動。請參閱上面的錯誤訊息...


---------------------------
服務
---------------------------
在 本地計算機 無法啟動 OracleOraHome92TNSListener 服務。

錯誤 1067: 程式意外終止。

---------------------------
確定
---------------------------

ORA-12560: TNS: 協議介面卡錯誤的解決方法

造成ORA-12560: TNS: 協議介面卡錯誤的問題的原因有個:

1.監聽服務沒有起起來。windows平臺個一如下操作:開始---程式---管理工具---服務,開啟服務皮膚,啟動oraclehome92TNSlistener服務。

2.database instance沒有起起來。windows平臺如下操作:開始---程式---管理工具---服務,開啟服務皮膚,啟動oracleserviceXXXX, XXXX就是你的database SID.

3.登錄檔問題。regedit,然後進入HKEY_LOCAL_MACHINESOFTWAREORACLEHOME0將該環境變數ORACLE_SID設定為XXXX, XXXX就是你的database SID.或者右幾我的電腦,屬性--高階--環境變數---系統變數--新建,變數名=oracle_sid,變數值=XXXX, XXXX就是你的database SID.或者進入sqlplus前,在command line下輸set oracle_sid=XXXX, XXXX就是你的database SID.

經過以上步驟,就可以解決問題。

=======================================
TNS: 協議介面卡錯誤的問題的原因有三個:
1.監聽服務沒有起起來。windows平臺個一如下操作:開始---程式---管理工具---服務,開啟服務皮膚
,啟動oraclehome92TNSlistener服務。
2.database instance沒有起起來。windows平臺如下操作:開始---程式---管理工具
---服務,開啟服務皮膚,啟動oracleserviceXXXX,XXXX就是你的database SID.
3.登錄檔問題。regedit,然後進入HKEY_LOCAL_MACHINESOFTWAREORACLEHOME0將該
環境變數ORACLE_SID設定為XXXX,XXXX就是你的database SID.或者右幾我的電腦,屬性--高階--環境變數---系統變數--新建,變數名=oracle_sid,變數值=XXXX,XXXX就是你的database SID.或者進入sqlplus前,在command line下輸set oracle_sid=XXXX,XXXX就是你的database SID.
經過以上步驟,就可以解決問題

1、ORA-12541:TNS:沒有監聽器
  原因:沒有啟動監聽器或者監聽器損壞。如果是前者,使用命令net start
OracleOraHome81TNSListener(名字可能有出入)即可;如果是後者,則使用“Net8Configuration

Assistant”工具嚮導之“監聽程式配置”增加一個監聽器即可(基本不用寫任何資訊,一路OK。在新增之前可能需要把所有的監聽器先刪除!)
2、ORA-12500:TNS:監聽程式無法啟動專用伺服器程式或ORA-12560:TNS:協議適
配器錯誤
  原因:ORACLE的資料庫服務沒有啟動。使用命令net start ORACLESERVICEORADB
(ORADB為資料庫名字)即可。如果仍沒有解決,請繼續向下看。

3、如果資料庫服務啟動失敗,則很有可能是其登錄檔項值損壞,最好的做法是以下兩步:
  1)ORADIM -DELETE -SID oradb 刪除資料庫服務項
  2)ORADIM -NEW -SID oradb 新增資料庫服務項
  注:這個過程中如果出錯,就重啟計算機!
4、ORA-12154:TNS:能解析服務名
  原因:ORACLE的網路服務名沒有正確配置。請使用“Net8 Configuration
Assistant”工具嚮導之“本地網路服務名配置”配置TNS即可。如果仍沒有解決,請繼續向下看。
5、ORA-1034 :TNS:ORACLE不可用
  原因:ORACLE的資料庫服務正確啟動,但是資料庫沒有開啟!
  使用命令:
  1)svrmgrl 啟動服務管理器
  2)connect internal 以internal身份登陸
  3)startup 開啟資料庫
6、ORA-12560:TNS:協議介面卡錯誤(頑固性的)
  原因:未知。
  解決:必殺技--開啟“Windows工作管理員”,殺死ORACLE.exe及ORADIM.exe進
程,書寫自己的

ora_startup.bat,執行之!
PS:
1、我的ora_startup.bat:
net start OracleOraHome81TNSListener
net start ORACLESERVICEORADB
svrmgrl 一般情況下不用,不過有時少不了它的,具體步驟見第5步。
2、我的ora_shutdown.bat:
net stop OracleOraHome81TNSListener
net stop ORACLESERVICEORADB

  ORACLE_HOME=/u01/app/oracle/product/8.1.6
  export ORACLE_HOME/ 包括Oracle軟體的目錄 /
  LD_LIBRARY_PATH=/u01/app/oracle/product/8.1.6/lib;
  export LD_LIBRARY_PATH
  ORACLE_BASE=/u01/app/oracle
  export ORACLE_BASE/ 包括Oracle軟體的目錄和管理軟體的目錄 /
  ORACLE_SID=ORCL
  export ORACLE_SID/ 預設資料庫的標識 /
  ORACLE_TERM=vt100
   export ORACLE_TERM
  ORA_NLS33=/u01/app/oracle/product/8.1.6/
  ocommon/nls/admin/data
  export ORA_NLS33 / 語言支援 /
  PATH=$PATH: /u01/app/oracle/product/8.1.6/bin
  export PATH


=============================================
ORA-12560 STARTING LISTENER ON NT - TROUBLESHOOTING
---------------------------------------------------

ORA-12560: TNS Protocol adapter error
Cause: A generic protocol adapter error occurred.
Action: Check addresses used for proper protocol specification. Before reporting this error, look at the error stack and check for lower level transport errors.For further details, turn on tracing and reexecute the operation. Turn off tracing when the operation is complete.

This is a high level error just reporting an error occurred in the actual transport layer. Look at the next error down the stack and process that.


1.- Starting Listener with TCP/IP Protocol

Problem:
You start the TNS Listener from command line and the TCP/IP address fails with a TNS-12560.

Solution:
Check if Microsoft Winsock Proxy(WSP) Client is enabled on the Windows NT Server, if that is the case then go to windows Control
Panel, click WSP icon and select the disable Proxy Client option.

Explanation:
The Winsock application may fail to bind to a specific port on a Proxy Server computer when the Winsock is running Proxy Client.

2.- TNS-12560 TNS-512 Starting the listener.

Problem:
You try to start up the listener and receive the following error stack:
TNS-12542: TNS:address already in use
TNS-12560: TNS Protocol adapter error
TNS-00512: Address already in use
32-bit Windows Error: 48: Unknown error

Error: TNS 512
Text: Address already in use
--------------------------------------------
Cause: Specified listener address is already being used.
Action: Start your listener with an unused address.

Generally this problem may ocurr for a incorrect setting in the listener.ora. Some causes of this problems may be:

a.- Some defined address in the listeners.ora is been used. Make sure other listeners are not running. Either listener.log and screen
output appear the address with problem.

b.- Just for 8i: in windows NT the algorithm to acquire
the address has change, please check the Note 69026.1: Oracle 8i and socket LISTEN operations.

Explanation:
The listener will try to acquire the address in exclusive mode, if this
is been used then the process to get it will fail.

3.- Starting the listener the errors ORA-12203,ORA-12560, NL-462 or NL-427 may be raised.

Problem:
You try to start up the listener and receive the following errors
ORA-12203,ORA-12560, NL-462 or NL-427.

Solution:
Recreate the listener.ora file.

Explanation:
Some corruption in the listener.ora may get unable to the tnslsnr to work adequatly.


4.- Failed to start service, TNS-12560, TNS-00530 when create new listener services

Problem:
To recreate Oracle TNS listener service on Windows NT, you delete the service entry in registry. When using lsnrctl to start the listener, you get the following errors:

LSNRCTL> start
Starting tnslsnr: please wait...

Failed to start service, error 3.

TNS-00530: Protocol adapter error

The Listener service is not recreated and the Listener would not start.
You are using a valid listener.ora file and protocol adapters.


Solution:
After you delete the Listener service from registry, you have to reboot
NT for it to take effect. Then you can use lsnrctl to start the Listener, which would re-create the listener service.


Explanation:
The Listener service is marked 'disabled', but it still exists after
you delete the service from registry.

[@more@]
oracle的監聽起不來: TNS:address already in use
==============解決方法==========================

LSNRCTL> status

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=testhost)(PORT=1521)))

TNS-12535: TNS:operation timed out

TNS-12560: TNS:protocol adapter error

TNS-00505: Operation timed out

IBM/AIX RISC System/6000 Error: 78: Connection timed out

LSNRCTL> start
Starting /opt/oracle/product/10.1.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for IBM/AIX RISC System/6000: Version 10.1.0.5.0 - Production
System parameter file is /opt/oracle/product/10.1.0/db_1/network/admin/listener.ora
Log messages written to /opt/oracle/product/10.1.0/db_1/network/log/listener.log
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=testhost)(PORT=1521)))
TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adapter error
TNS-00512: Address already in use
IBM/AIX RISC System/6000 Error: 67: Address already in use

Listener failed to start. See the error message(s) above...

===========================

ORA-12542: TNS:address already in use
Cause: Specified listener address is already being used.
Action: Start your listener with a unique address.

===========================

很明顯呀,你的監聽已經起來了麼。
看看lsnrctl status是不是已經啟動了?
或者你要看看你的要監聽的埠是不是已經被佔用了?
netstat -an | grep 埠號

AIX 怎麼檢視埠占用情況?

netstat -an

ps -ef | grep xxxx

kill -9 PID

AIX中檢視埠對應的程式或服務的方法

Solution Here is a method that can be used to determine what process is using a particular port:
1.
Run netstat to get the address of the port you need to check:
eg.
[root:/:] netstat -Aan | grep 8880
701995f0 tcp4 0 0 *.8880 *.* LISTEN
2.
Now use the address seen in the first column as the first parameter to the rmsock command. The second parameter is "tcpcb"
eg.
[root:/:] rmsock 701995f0 tcpcb
The socket 0x70199400 is being held by process 26792 (java).
Please note.... rmsock is used to remove sockets that do not have file descriptors. However, rmsock doesn't remove a socket that still has a valid file descriptor but, instead, returns the identity of the process owner.
3.
Finally, use "ps -ef" to identify the actual process.

===========================

怎樣釋放被程式佔用的埠

可用refresh -s inetd就可以了

Windwos

問題已解決,改完登錄檔後需重啟機器。

使用 regedit 命令,修改登錄檔:
1. HKEY_LOCAL_MACHINESYSTEMCurrentControlSet ServicesTCPIPParameters 登錄檔子鍵並建立名為 TcpTimedWaitDelay 的新 REG_DWORD 值。 將此值設定為十進位制 30,其為十六進位制 0x0000001e。該值將等待時間設定為 30 秒。
預設值:0xF0,它將等待時間設定為 240 秒(4 分鐘)。建議值:最小值為 0x1E,它將等待時間設定為 30 秒。
2. HKEY_LOCAL_MACHINESYSTEMCurrentControlSet ServicesTCPIPParameters 登錄檔子鍵並建立名為 MaxUserPort 的新 REG_DWORD 值。 預設值:無 建議值:至少十進位制 32768。 注:當在 Windows NT 或 Windows 2000 作業系統上調整 WebSphere Application Server 時。

完成後重啟機器。

===========================

ORACLE例項在啟動時,或使用命令ALTER SYSTEM REGISTER ,或每隔一分鐘,PMON程式會向監聽進行動態註冊

1、監聽在啟動時,會從$ORACLE_HOME/network/admin/listener.ora讀取監聽配置,如果該檔案不存在,則監聽會在主機名對應的IP和1521埠上進行監聽。可以看到監聽剛剛啟動的時候,並沒有註冊的服務
LSNRCTL> start
Starting tnslsnr: please wait...

TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Log messages written to f:oracleproduct10.2.0networkloglistener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 14-APR-2008 21:29:40
Uptime 0 days 0 hr. 0 min. 2 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File f:oracleproduct10.2.0networkloglistener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1521)))
The listener supports no services
The command completed successfully

2、過了大概1分鐘,PMON程式會將服務註冊進來
LSNRCTL> status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 14-APR-2008 21:29:40
Uptime 0 days 0 hr. 1 min. 57 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File f:oracleproduct10.2.0networkloglistener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1521)))
Services Summary...
Service "test" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "testXDB" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "test_XPT" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
The command completed successfully

3、但是PMON程式只向預設的1521埠的監聽註冊,當監聽不在1521埠時,需要使用下面的方法:

a、直接在引數local_listener中輸入監聽地址,PMON程式會根據此資訊,並進行註冊
sys@TEST>alter system set local_listener='(address=(protocol=tcp)(port=1522)(host=linan))';

System altered.

b、或者只在引數local_listener中輸入監聽的名稱
sys@TEST>alter system set local_listener='test';

System altered.

在$ORACLE_HOME/network/admin/tnsnames.ora中包含監聽地址,PMON程式會從此處得監聽資訊,並進行註冊
TEST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.102)(PORT = 1522))

4、但有3點需要注意的地方:
a、PMON程式1分鐘執行一次,當監聽剛剛啟動的時候,可能服務還沒有註冊進去,這時候是不能使用此服務的
b、在修改local_listener引數時,PMON程式也會重新註冊一次
c、如果資料庫shutdown後,PMON程式也停止了,服務會從監聽中刪除,這時候只能使用OS認證的方式連入資料庫

LSNRCTL> statusConnecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linan)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias listener1
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 14-APR-2008 21:14:04
Uptime 0 days 0 hr. 10 min. 15 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File f:oracleproduct10.2.0networkadminlistener.ora
Listener Log File f:oracleproduct10.2.0networkloglistener1.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1522)))
Services Summary...
Service "test" has 1 instance(s).
Instance "test", status BLOCKED, has 1 handler(s) for this service...
Service "testXDB" has 1 instance(s).
Instance "test", status BLOCKED, has 1 handler(s) for this service...
Service "test_XPT" has 1 instance(s).
Instance "test", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully

sys@TEST>shut immediateDatabase closed.
Database dismounted.
ORACLE instance shut down
.

LSNRCTL> statusConnecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linan)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias listener1
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 14-APR-2008 21:14:04
Uptime 0 days 0 hr. 10 min. 49 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File f:oracleproduct10.2.0networkadminlistener.ora
Listener Log File f:oracleproduct10.2.0networkloglistener1.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1522)))
The listener supports no services
The command completed successfully

===========================

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25067344/viewspace-1052104/,如需轉載,請註明出處,否則將追究法律責任。

相關文章