与Instant-client连接时出现ora-12154问题

时间:2012-11-02 18:43:06

标签: database oracle oracle11g tnsnames ora-12154

我在Windows Server 2008R2上运行Oracle 11g。我有一个客户端应用程序(Zabbix)在其他地方运行,试图连接到它。

客户端计算机具有:

  • 甲骨文instantclient11.2碱性-11.2.0.3.0-1.i386.rpm
  • 甲骨文instantclient11.2-devel的-11.2.0.3.0-1.i386.rpm

因此,它没有sqlnet.ora或tnsnames.ora文件。它试图建立与直接寻址的连接。在php中有一个print语句,我看到它正在调用

ociplogon(user,password,$connect);

将connect设置为 // dbhostmachine:1521 / zabbix 。所以一切看起来都不错。

C:\Users\mdobrini> lsnrctl services

LSNRCTL for 64-bit Windows: Version 11.1.0.7.0 - Production on 02-NOV-2012 13:00:55

Copyright (c) 1991, 2008, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbhostmachine.dddd.cccc.com)(POR
Services Summary...
Service "zabbix" has 1 instance(s).
  Instance "zabbix", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:578 refused:0 state:ready
         LOCAL SERVER
Service "zabbixXDB" has 1 instance(s).
  Instance "zabbix", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: dbhostmachine, pid: 6384>
         (ADDRESS=(PROTOCOL=tcp)(HOST=dbhostmachine.dddd.cccc.com)(PORT=61396))
Service "zabbix_XPT" has 1 instance(s).
  Instance "zabbix", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:578 refused:0 state:ready
         LOCAL SERVER
The command completed successfully

尝试在本地连接正常工作:

SQL*Plus: Release 11.1.0.7.0 - Production on Fri Nov 2 13:06:31 2012

Copyright (c) 1982, 2008, Oracle.  All rights reserved.

Enter user-name: SYSTEM
Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production

SQL> connect uuu/ppp@localhost/zabbix
Connected.
SQL>  

然而,远程我得到了流行的错误:

ociplogon(): ORA-12154: TNS:could not resolve the connect identifier specified 

奇怪的是它之前是间歇性地工作。我的应用程序每10秒钟会出现一个错误:

30923:20121101:142237.595 [Z3001] connection to database '//dbhostmachine:1521/zabbix'     failed: [-1] ORA-12516: TNS:listener could not find available handler with matching   protocol stack
30923:20121101:142237.596 watchdog: database is down

但是肯定有数据通过网络发送,并且持久存在于数据库中。在重新启动应用程序和服务器之后,我再也无法建立连接了,而且在ORA-12154上很糟糕

1 个答案:

答案 0 :(得分:0)

ORA-12154是由DNS问题引起的。切换到消失的IP地址后。

ORA-12516是由数据库上达到的最大会话/进程引起的。在调整了它以及一些PHP OCI8参数之后,它也消失了。