ORA-01804 error while trying to load “Oracle” dbDr

2020-05-06 11:03发布

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?

2条回答
ら.Afraid
2楼-- · 2020-05-06 11:46

ORA-01804: failure to initialize timezone information Cause: The timezone information file was not properly read.

The reason was that my linux oracle client was missing some timezone related files in its $ORACLE_HOME directory. The solution was to simply copy those files from another instance of oracle client.

This is a generic error message from the Oracle Database indicating that the timezone information file was not properly read. Below are the most common solutions:

1) Your oracle client may be missing some timezone related files in its$ORACLE_HOMEdirectory. You can try simply copying those files from another instance of oracle client.

2) Binary may not have permission to access the OCCI library. Please ensure permissions are in correctly in place.

3) Check to make sure the following paths are set correctly in your environment: LD_LIBRARY_PATH ORACLE_HOME NLS_LANG

查看更多
闹够了就滚
3楼-- · 2020-05-06 11:47

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")
查看更多
登录 后发表回答