ORACLE监听配置和数据库连接问题[ORA-12154]的解决
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://miracle.blog.51cto.com/255044/53772 |
当我们安装并新建数据库的时候,往往都会需要配置监听(LISTENER),但有时我们会碰到数据库无法连接的情况。其中一个经典的错误就是: 12154, 00000, "TNS:could not resolve service name" // *Cause: The service name specified is not defined correctly in the // TNSNAMES.ORA file. // *Action: Make the following checks and correct the error: // - Verify that a TNSNAMES.ORA file exists and is in the proper // place and accessible. See the operating system specific manual // for details on the required name and location. // - Check to see that the service name exists in one of the // TNSNAMES.ORA files and add it if necessary. // - Make sure there are no syntax errors anywhere in the file. // Particularly look for unmatched parentheses or stray characters. // Any error in a TNSNAMES.ORA file makes it unusable. See // Chapter 4 in the SQL*Net V2 Administrator's Guide. If // possible, regenerate the configuration files using the Oracle // Network Manager. 我们一般都是先检查CLIENT端的配置是否出现问题。如果我们检测客户端没有问题,就需要考虑SERVER端LISTENER的配置了。 以下为一个LISTENER.ORA的例子: LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521)) ) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC)) ) ) ) 或 LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.11.100)(PORT = 1521)) ) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC)) ) ) ) 这两个配置在大多数情况下是没有问题的,但是一旦当网络情况复杂的时候,我们的连接就无法进行了。 我曾处理过这样的一些情况,象对于使用VPN或者防火墙进行地址映射进行连接等情况,这样的配置就有可能出现问题。 原因就在于HOST的配置。localhost.localdomain或者192.168.11.100的配置都会造成LISTENER只是监听指定的IP地址,而复杂的网络环境或者是数据库主机修改IP地址等都会直接造成IP变化而无法正常监听连接要求。所以还是非常建议使用主机名称的方式。例如:HOST=XXDB1,这样就会减少12154出错的可能了。 附赠:当然在LINUX环境下,IPTABLES会自动开启,便会造成12533的错误出现。 12533, 00000, "TNS:illegal ADDRESS parameters" // *Cause: An illegal set of protocol adapter parameters was specified. In // some cases, this error is returned when a connection cannot be made to the // protocol transport. // *Action: Verify that the destination can be reached using the specified // protocol. Check the parameters within the ADDRESS section of // TNSNAMES.ORA. Legal ADDRESS parameter formats may be found in the // Oracle operating system specific documentation for your platform. // Protocols that resolve names at the transport layer (such as DECnet object // names) are vulnerable to this error if not properly configured or names are // misspelled. 如果可以设定IPTABLES最好,当情急之下,还是一关了之来的痛快 :-) 1) 即时生效,重启后失效 开启: service iptables start 关闭: service iptables stop 2) 重启后生效 开启: chkconfig iptables on 关闭: chkconfig iptables off 本文出自 “Be the miracle!” 博客,请务必保留此出处http://miracle.blog.51cto.com/255044/53772 本文出自 51CTO.COM技术博客 |



Larry.Yue
博客统计信息
热门文章
最新评论
友情链接