简体   繁体   English

OCI_connect / OCIPLogon ORA-01031:特权不足

[英]OCI_connect/OCIPLogon ORA-01031: insufficient privileges

We have two oracle accounts log_reader and log_writer. 我们有两个Oracle帐户log_reader和log_writer。 log_reader has read access for reading data. log_reader具有读取数据的读取权限。 log_writer has write access writting data into database. log_writer具有将数据写入数据库的写访问权。 The application is run from Apache and uses Perl and PHP. 该应用程序从Apache运行,并使用Perl和PHP。 Passwords are hardcoded into php/perl scripts. 密码被硬编码到php / perl脚本中。 Recently we are trying to migrate to Oracle Wallet to eliminate hard coded passwords. 最近,我们正尝试迁移到Oracle Wallet,以消除硬编码的密码。 Oracle wallet is configured and following works - sqlplus and perl for both log_reader and log_writer accounts. 已配置Oracle钱包,并且可以正常工作-log_reader和log_writer帐户的sqlplus和perl。 php for log_reader account. php for log_reader帐户。 php does not work for log-writer account. php不适用于日志记录器帐户。 We get following error - 我们收到以下错误-

insert err = 1031:ORA-01031: insufficient privileges

PHP code - PHP代码-

    $conn = OCIPLogon("/", "", "SLACDEV", "", OCI_CRED_EXT);

In short with Oracle Wallet there is no problem for sqlplus and Perl. 简而言之,对于Oracle Wallet,sqlplus和Perl没问题。 But for PHP we are facing issue when we try to write/insert data into database. 但是对于PHP,当我们尝试向数据库中写入/插入数据时我们面临着问题。 Read for PHP works fine. 阅读PHP效果很好。

I have tried following so far but no luck - 到目前为止,我已经尝试了以下尝试,但是没有运气-

    $conn = OCIPLogon("/", "", "SLACDEV", "", OCI_CRED_EXT);
    $conn = OCIPLogon("/", "", "SLACDEV", "", OCI_CRED_EXT+OCI_SYSOPER);
    $conn = OCIPLogon("/", "", "SLACDEV", "", OCI_CRED_EXT+OCI_SYSDBA);

php does not work for log-writer account. php不适用于日志记录器帐户。 We get following error - 我们收到以下错误-

insert err = 1031:ORA-01031: insufficient privileges

The solution was to create the two wallet entries, set the two connection names in tnsnames.ora, and make sure environment variables were set in the environment starting the web server. 解决方案是创建两个钱包条目,在tnsnames.ora中设置两个连接名称,并确保在启动Web服务器的环境中设置了环境变量。 Thanks to Christopher Jones for his help to get this resolved. 感谢克里斯托弗·琼斯(Christopher Jones)的帮助,以解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM