ORA-12170: TNS: Connection timeout problem solved
The virtual machine can access the database normally, but the physical machine connection to the database appeared "ORA-12170: TNS: Connection timeout", you can solve the problem with the following ideas.
I. Check the network
1. ping the IP address to view network problems and check whether the ping is successful;
2. tnsping IP address (or server instance name SID) If "TNS-12535: Operation timeout" is reported, it may be the server-side firewall, not disabled;
3. Check whether port 1521 is disabled in netstat-na.
4. lsnrctl status lsnrctl is the abbreviation of listener-control listener. You can view the status of the listener.
If the problem is caused by a firewall, you can disable the firewall or modify the firewall rules to solve the problem (currently, only access to the wall is encountered ).
Ii. Firewall Problems
2.1 disable Firewall
Chkconfig iptables off; # failure after restart
/Etc/init. d/iptables stop; # expire immediately
2.2 modify firewall rules
1) open the port directly.
Iptables-I INPUT-p tcp -- dport 1521-j ACCEPT; #1521 is the port number;
# If you want to delete a rule, use iptables-d input number;
# Number can be viewed using/etc/init. d/iptables status
# If this method is used, the rule is invalid when the machine is restarted or the firewall is disabled.
2) permanently open a port
First, use vim to open the firewall configuration file:
Vim/etc/sysconfig/iptables
Then, add the following content in the content of the iptables file under the default port 22:
-A input-m state -- state NEW-m tcp-p tcp -- dport 1521-j ACCEPT
Finally, save the configuration file and run the following command to restart the Firewall:
/Etc/init. d/iptables restart
# After testing, add "-A…" to/etc/sysconfig/iptables ......" This content is, in position 1 add statement, after restarting the firewall can connect to the database; in 2 add statement, after restarting the firewall is still reported "ORA-12170: TNS: Connection timeout ".