环境: 数据库服务器 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
/Aj?*h_I0`-D pS008 09:45:01
Copyright (c) 1997, 2006, Oracle Corporation. All rights reserved.
Used parameter files:ITPUB个人空间T1b.^^+YFvx
D:\oracle\ora92\network\admin\sqlnet.ora
H/]w;m5fA0Used TNSNAMES adapter to resolve the alias
k)?5zr7T+\t'yb,\"r0Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
q#F'}F3h0(HOST = 192.168.1.206)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME =orcl)))ITPUB个人空间Hy8V7~$V3V!{
TNS-12560: TNS:protocol adapter error
AV Y0H!l'O0
实例采用静态注册 在服务器上运行正常
[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)))
/oEp%O)g0STATUS of the LISTENER
Q9a K!A7NU%\+s-`
{:\0------------------------
%I5ShU^^]2a0Alias LISTENERITPUB个人空间u?KH
y Q*[Gb(_
Version TNSLSNR for Linux: Version 10.2.0.1.0 - ProductionITPUB个人空间#Y:A;Z'u JA
Start Date 07-JUL-2008 08:40:31ITPUB个人空间`i6S9YIM!k
Uptime 0 days 0 hr. 4 min. 8 sec
"uCS1Vqq3vB#|0Trace Level offITPUB个人空间yg
I,d["o?
Security ON: Local OS AuthenticationITPUB个人空间c7cL)N%OMMW6M0|
SNMP OFF
U;T`,i4`0Listener Parameter File /oracle/10.2/db/network/admin/listener.ora
}Cbt }X3_0Listener Log File /oracle/10.2/db/network/log/listener.log
m#V|`K*mr7?;p._0Listening Endpoints Summary...
1E8H {3| C0 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.206)(PORT=1521)))ITPUB个人空间0G\$V/w(j])R w+U
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))ITPUB个人空间4nO2XCv-Z(H6C`7o/~ Q5}
Services Summary...ITPUB个人空间0OEM!neF/`
Service "+ASM" has 1 instance(s).
$J*g4cQon!Z!]0 Instance "+ASM", status UNKNOWN, has 1 handler(s) for this service...
8S:z)Ur3Oc wn0Service "PLSExtProc" has 1 instance(s).ITPUB个人空间7j
Rz@(i%]w5Qw7zG
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...ITPUB个人空间.\@"KeZq/h+[
\)l V
Service "orcl" has 1 instance(s).
-X!FtxC+gp0 Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
g o,xg*N l,H D J0The command completed successfullyITPUB个人空间2Q\.y+]uF6`1T5K;P/r k
e;A
v(@7s'_O)?o G)b.?0[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:
ITPUB个人空间)ewmU+_g/B8rF6V
Used TNSNAMES adapter to resolve the alias
gIZs
P0Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =192.168.1.206)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
a)Jnjd!jIf0OK (10 msec)
3Rx
C;q{0[oracle@localhost admin]$
e~@XEji0
最后想到防火墙问题 把防火墙关闭后
[root@localhost ~]# service iptables stopITPUB个人空间c bi-}2l{#F-r7Zie
Flushing firewall rules: [ OK ]
b8n.pw,z"C:Nh*U0Setting chains to policy ACCEPT: filter [ OK ]ITPUB个人空间6e(u!b5D6L?
t
Unloading iptables modules: [ OK ]ITPUB个人空间7^ _P5h:zb9|{
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
L/FBW*s^008 09:52:13
Copyright (c) 1997, 2006, Oracle Corporation. All rights reserved.
Used parameter files:ITPUB个人空间g%f~B"X&P?4YRnJ
D:\oracle\ora92\network\admin\sqlnet.ora
ITPUB个人空间k4q1xB2Bl;FVy
Used TNSNAMES adapter to resolve the aliasITPUB个人空间 G(i,u"WI3d:qZk
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TITPUB个人空间\3@YgrX
p2O
(HOST = 192.168.1.206)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME =orcl)))ITPUB个人空间DG$M#M)A0s
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
k4CrT\Dd0允许1520到1523的端口访问
[root@localhost ~]# service iptables restartITPUB个人空间XM;~m3d[9qM)S'~%lZl j
Flushing firewall rules: [ OK ]ITPUB个人空间q7|@1s4e:U"O
Setting chains to policy ACCEPT: filter [ OK ]ITPUB个人空间M `~QT
Unloading iptables modules: [ OK ]ITPUB个人空间/R[5j
DC
Applying iptables firewall rules: [ OK ]
Zo:?(an9B0