The database can be accessed normally on the virtual machine, but when you connect to the database on a physical machine with "Ora-12170:tns: Connection timed out", you can use the following ideas to resolve the issue.
First, check the network
1.ping IP address to see the network problems, see if you can ping;
2.tnsping IP address (or the server's instance name SID) if the "TNS-12535: Operation Timeout", may be the server-side firewall, does not shut down;
3.netstat-na See if Port 1521 is off
4.lsnrctl status Lsnrctl is an abbreviation for the Listener-control listener to view the status of the listener
If it is a firewall problem, you can either turn off the firewall or modify the firewall rules to resolve the problem (currently only experiencing access walls).
Second, firewall issues
2.1 Shutting down the firewall
Chkconfig iptables off; #重启后失效
/etc/init.d/iptables stop; #立即失效
2.2 Modifying firewall rules
1) Open port directly
Iptables-i input-p TCP--dport 1521-j ACCEPT; #1521是端口号;
#如果要删除规则, just use iptables-d INPUT number;
#number可以用 /etc/init.d/iptables status to view
#使用这种方式, the machine restarts or the firewall is turned off and the rule fails.
2) permanently open a port
First, open the firewall configuration file with vim:
Vim/etc/sysconfig/iptables
Then, in the Iptables file content, under the default port 22, add the following line:
-A input-m state--state new-m tcp-p TCP--dport 1521-j ACCEPT
Finally, after saving the configuration file, execute the following command to restart the firewall:
/etc/init.d/iptables restart
#经过测试, add "-a ..." to the/etc/sysconfig/iptables, add the statement in position 1, the database can be connected after restarting the firewall, add the statement at 2, and still report "Ora-12170:tns: Connection timed out" after restarting the firewall.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/84/50/wKioL1eMsgmiXPaWAABAb2rKwl0479.png "title=" Clipboard.png "alt=" Wkiol1emsgmixpawaabab2rkwl0479.png "/>
This article from the "Three countries Cold Jokes" blog, reproduced please contact the author!
Fix the "Ora-12170:tns: Connection Timeout" issue