在连接/运行Oracle SQL命令时,我经常收到随机错误。这可以在一天的99%工作,但随机大约10分钟我们将得到一堆错误,SQL查询全部失败。
很抱歉以下所有代码,只是尝试提供帮助
错误是:
PHP Warning: oci_connect() [<a href='function.oci-connect'>function.oci-connect</a>]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries in /var/www/db.php on line 59, referer: https://www.abc.com/abc.php
Oracle Instant Client:
root@server:/opt/oracle/instantclient# pwd
/opt/oracle/instantclient
root@server:/opt/oracle/instantclient# ls -l
total 99940
-rw-r--r-- 1 root root 238 2009-07-03 14:40 BASIC_README
-r--r--r-- 1 root root 1609607 2009-07-03 14:40 classes12.jar
-rwxr-xr-x 1 root root 67766 2009-07-03 14:40 genezi
lrwxrwxrwx 1 root root 17 2009-07-03 14:41 libclntsh.so -> libclntsh.so.10.1
-rwxr-xr-x 1 root root 19076649 2009-07-03 14:40 libclntsh.so.10.1
-r-xr-xr-x 1 root root 5656445 2009-07-03 14:40 libnnz10.so
lrwxrwxrwx 1 root root 15 2009-07-03 14:41 libocci.so -> libocci.so.10.1
-rwxr-xr-x 1 root root 1398244 2009-07-03 14:40 libocci.so.10.1
-rwxr-xr-x 1 root root 72698427 2009-07-03 14:40 libociei.so
-r-xr-xr-x 1 root root 120443 2009-07-03 14:40 libocijdbc10.so
-r--r--r-- 1 root root 1555682 2009-07-03 14:40 ojdbc14.jar
drwxrwxr-x 4 root root 4096 2008-02-17 08:58 sdk
其他有用信息:
root@server:/# cat /etc/apache2/envvars
# envvars - default environment variables for apache2ctl
# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2.pid
export LD_LIBRARY_PATH=/opt/oracle/instantclient
在脚本内部,我们调试任何错误,并在遇到这些错误时通过电子邮件发送报告,以便进一步尝试和调试问题。我正在做以下事情:
if(isset($ocierr) && $ocierr!="")
$mb.="Oracle OCI Error: ".$ocierr."\n\n";
$mb.="Oracle Error Message: ".print_r($errmsg,true)."\n\n";
$mb.="Debugging:\nLD_LIBRARY_PATH: ".var_export(getenv('LD_LIBRARY_PATH'),true);
返回:
Oracle Error Message:
Cannot contact to Oracle
Debugging:
LD_LIBRARY_PATH: '/opt/oracle/instantclient'