尝试加载"Oracle"时出现ORA-01804错误dbDriver [英] ORA-01804 error while trying to load "Oracle" dbDriver

查看:3116
本文介绍了尝试加载"Oracle"时出现ORA-01804错误dbDriver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ROracle 并执行以下操作R中的命令:

Sys.getenv()
drv <- dbDriver("Oracle")

这是我在最后一行之后得到的错误:

Error in .oci.Driver(.oci.drv(), interruptible = interruptible, unicode_as_utf8 = unicode_as_utf8,  :
  Error while trying to retrieve text for error ORA-01804

我正在使用 RStudio服务器在RHEL 5服务器上工作. /p>

如何避免此错误?

解决方案

您必须检查这2点:

    必须定义
  • ORACLE_HOME环境变量
  • $ORACLE_HOME/lib路径必须位于LD_LIBRARY_PATH环境变量值中

例如,如果您的ORACLE_HOME/usr/lib/oracle/12.1/client64(这是带有官方.rpm的Oracle Instant Client安装中的默认设置),请执行以下R命令:

Sys.setenv("ORACLE_HOME" = "/usr/lib/oracle/12.1/client64")
Sys.getenv("LD_LIBRARY_PATH")
# Here check if /usr/lib/oracle/12.1/client64/lib is a part (separated by ":" of the result)
# else, append ":/usr/lib/oracle/12.1/client64/lib" to the result and set the environment variable using:
# Sys.setenv("LD_LIBRARY_PATH" = "/all/the/result:/of/getenv/command:/usr/lib/oracle/12.1/client64/lib")

I'm using ROracle and do the following commands in R:

Sys.getenv()
drv <- dbDriver("Oracle")

And here is the error I obtain after this last line:

Error in .oci.Driver(.oci.drv(), interruptible = interruptible, unicode_as_utf8 = unicode_as_utf8,  :
  Error while trying to retrieve text for error ORA-01804

I'm on RStudio Server working on a RHEL 5 server.

How could I avoid this error?

解决方案

You have to check those 2 points:

  • ORACLE_HOME environment variable must be defined
  • $ORACLE_HOME/lib path must be in LD_LIBRARY_PATH environment variable value

For example, if your ORACLE_HOME is /usr/lib/oracle/12.1/client64 (which is the default in Oracle Instant Client installation with the official .rpm), execute the following R commands:

Sys.setenv("ORACLE_HOME" = "/usr/lib/oracle/12.1/client64")
Sys.getenv("LD_LIBRARY_PATH")
# Here check if /usr/lib/oracle/12.1/client64/lib is a part (separated by ":" of the result)
# else, append ":/usr/lib/oracle/12.1/client64/lib" to the result and set the environment variable using:
# Sys.setenv("LD_LIBRARY_PATH" = "/all/the/result:/of/getenv/command:/usr/lib/oracle/12.1/client64/lib")

这篇关于尝试加载"Oracle"时出现ORA-01804错误dbDriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆