前几天安装好oracle12c后,今天想用客户端去连接oracle。
1,客户端能ping通ip
2,客户端无法tnsping通oracle
3,在服务器本机tnsping能连接到oracle
经过很久的问题查找后
4,在客户端直接ping ip 1521 不通 例如 ping 192.168.10.15 1521
5,判断是1521端口没有打开
6,打开1521端口
[root@ora1 ~]# sudo vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-A INPUT -p tcp -m statde --state NEW -m tcp -p tcp --dport 1521 -j ACCEPT
COMMIT
重启并保存
[root@ora1 ~]# sudo service iptables restart
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: iptables-restore v1.4.7: Couldn't load match `statde':/lib64/xtables-1.4.7/libipt_statde.so: cannot open shared object file: No such file or directory
Error occurred at line: 13
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
[FAILED]
[root@ora1 ~]# sudo service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
7,客户端顺利链接到oracle
附:查看1521端口状态
[oracle@ora1 ~]$ netstat -anp |grep tns
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 :::1521 :::* LISTEN 2512/tnslsnr
tcp 0 0 :::5500 :::* LISTEN 2512/tnslsnr
tcp 0 0 ::ffff:127.0.0.1:1521 ::ffff:127.0.0.1:33072 ESTABLISHED 2512/tnslsnr
unix 2 [ ACC ] STREAM LISTENING 18089 2512/tnslsnr /var/tmp/.oracle/s#2512.1
unix 2 [ ACC ] STREAM LISTENING 18091 2512/tnslsnr /var/tmp/.oracle/sEXTPROC1521
unix 2 [ ACC ] STREAM LISTENING 18093 2512/tnslsnr /var/tmp/.oracle/s#2512.2