TNS-12560: TNS:protocol adapter error 錯誤解決

paulyibinyi發表於2008-07-07

環境:  資料庫伺服器 linux rh4 +oracle 10.2.0.4

 客戶端:winxp sp2

連線資料庫時報TNS-12560錯誤

C:\Documents and Settings\Paul Yi>tnsping asm

TNS Ping Utility for 32-bit Windows: Version 9.2.0.8.0 - Production on 07-JUL-20
08 09:45:01

Copyright (c) 1997, 2006, Oracle Corporation.  All rights reserved.

Used parameter files:
D:\oracle\ora92\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 192.168.1.206)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME =orcl)))
TNS-12560: TNS:protocol adapter error

例項採用靜態註冊 在伺服器上執行正常

[oracle@localhost admin]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 07-JUL-2008 08:44:39

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.206)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                07-JUL-2008 08:40:31
Uptime                    0 days 0 hr. 4 min. 8 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/10.2/db/network/admin/listener.ora
Listener Log File         /oracle/10.2/db/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.206)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", 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...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

[oracle@localhost admin]$ tnsping asm

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 07-JUL-2008 08:56:12

Copyright (c) 1997, 2005, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =192.168.1.206)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (10 msec)
[oracle@localhost admin]$

最後想到防火牆問題 把防火牆關閉後

[root@localhost ~]# service iptables stop
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]

C:\Documents and Settings\Paul Yi>tnsping asm

TNS Ping Utility for 32-bit Windows: Version 9.2.0.8.0 - Production on 07-JUL
08 09:52:13

Copyright (c) 1997, 2006, Oracle Corporation.  All rights reserved.

Used parameter files:
D:\oracle\ora92\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = T
(HOST = 192.168.1.206)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME =orcl)))
OK (0 msec)

正常 ,但想一下是透過預設埠1521訪問的,所以允許訪問伺服器上的1521埠即可

 vi /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited

改為

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 1520:1523 -j ACCEPT
允許1520到1523的埠訪問

[root@localhost ~]# service iptables restart
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
Applying iptables firewall rules:                          [  OK  ]

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

相關文章