简体   繁体   English

如何在 Windows 7 64 位上安装 ROracle

[英]How to install ROracle on Windows 7 64-bit

This is a follow on to How to install ROracle package on Windows 7?这是如何在 Windows 7 上安装 ROracle 包?

I'm getting the following error trying to build ROracle我在尝试构建 ROracle 时遇到以下错误

** testing if installed package can be loaded ** 测试是否可以加载已安装的包
Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'D:/Users/a101/Documents/R/win-library/3.0/ROracle/libs/x64/ROracle.dll': LoadLibrary failure: %1 is not a valid Win32 application. inDL(x, as.logical(local), as.logical(now), ...) 中的错误:无法加载共享对象 'D:/Users/a101/Documents/R/win-library/3.0/ROracle/ libs/x64/ROracle.dll':LoadLibrary 失败:%1 不是有效的 Win32 应用程序。

I have RTools and 64-bit Oracle Instantclient installed我安装了 RTools 和 64 位 Oracle Instantclient
I execute the following from an Admin privieledged command line:我从管理员特权命令行执行以下操作:

set OCI_LIB64=C:/Oracle/instantclient_12_1_x64设置 OCI_LIB64=C:/Oracle/instantclient_12_1_x64
set OCI_INC=C:/Oracle/instantclient_12_1_x64/sdk/include设置 OCI_INC=C:/Oracle/instantclient_12_1_x64/sdk/include
"C:/Program Files/R/R-3.0.0/bin/x64/R" CMD INSTALL --build ROracle_1.1-10.tar.gz "C:/Program Files/R/R-3.0.0/bin/x64/R" CMD INSTALL --build ROracle_1.1-10.tar.gz

I've searched around and what I've found says this error is caused by building in mixed mode.我四处搜索,发现这个错误是由以混合模式构建的。 Ie 32-bit R with 64-bit Oracle client library or vice versa.即 32 位 R 与 64 位 Oracle 客户端库,反之亦然。 I've been looking at this for many (many) hours and I believe I'm using all 64-bit (OS, R, Oracle client library).我已经研究了很多(很多)小时,我相信我使用的是所有 64 位(OS、R、Oracle 客户端库)。 All the trace messages seem to indicate 64-bit everywhere.所有的跟踪消息似乎到处都是 64 位。

Any thoughts on what I might be missing?关于我可能缺少什么的任何想法?

To run dependency walk use Dependecy Walker, choose opening ROracle.dll in this app.要运行 Dependecy Walker,请选择在此应用中打开 ROracle.dll。 I had the same issue since ROracle.dll was searching for OCI x64 (Oracle client), whereas I had x86 version of it installed on my PC.我遇到了同样的问题,因为 ROracle.dll 正在搜索 OCI x64(Oracle 客户端),而我在我的 PC 上安装了它的 x86 版本。

I came across the same question, with 64bit windows and R... Since I shifted the ROracle from 32bit to 64bit some days before.我遇到了同样的问题,使用 64 位 Windows 和 R...因为ROracle我将ROracle从 32 位转移到 64 位。 After changing the OCI_LIB64, OCI_INC and also add the 64bit instantclient dir to the env variable Path , it works fine in R and RStudio.更改 OCI_LIB64、OCI_INC 并将 64 位即时客户端目录添加到环境变量Path ,它在 R 和 RStudio 中工作正常。

But I set up a task scheduler before, using Rscript.exe to run a RCode every day.但是我之前设置了一个任务调度器,每天使用Rscript.exe运行一个RCode。 That task failed since the shift with the same error:"Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'E:/app/R_lib/3.4/ROracle/libs/x64/ROracle.dll': LoadLibrary failure: %1 is not a valid Win32 application."该任务自换班后失败,并出现相同错误:“inDL(x, as.logical(local), as.logical(now), ...) 中的错误:无法加载共享对象 'E:/app/R_lib/ 3.4/ROracle/libs/x64/ROracle.dll':LoadLibrary 失败:%1 不是有效的 Win32 应用程序。”

My final solution is to restart the computer...And the task scheduler works again....guess there should be some 32bit file stored temporarily and need to be deleted before using 64bit ROracle...我的最终解决方案是重新启动计算机......然后任务调度程序再次工作......猜测应该有一些32位文件临时存储并且需要在使用64位ROracle之前删除......

You need to add the Oracle Client 32 and 64 bits witk SDK folder directory to the Windows System enviromental variables path.需要将Oracle Client 32位和64位witk SDK文件夹目录添加到Windows系统环境变量路径中。 Also need to install rjava package (install java 64 bits) and set JAVA_HOME in R sys.setenv().还需要安装 rjava 包(安装 java 64 位)并在 R sys.setenv() 中设置 JAVA_HOME。

install.packages("rJava")       #Install Java 64 bits
library(rJava)                  #Not Errors

Sys.setenv("OCI_LIB64"="C:/instantclient_12_2_64bits")
Sys.setenv("OCI_LIB32" = "C:/instantclient_12_2_64bits")
Sys.setenv("ORACLE_HOME" = "C:/instantclient_12_2_64bits")

Sys.setenv(JAVA_HOME='C:/Program Files/Java/jre1.8.0_241')

install.packages(paste0(path,"/ROracle_1.3-1.tar.gz"), repos = NULL, type = "source")
library(ROracle)

The last message in the install process should be DONE!安装过程中的最后一条消息应该是 DONE!

In the Windows System enviromental path:在 Windows 系统环境路径中:

C:\instantclient_12_2_64bits;
C:\instantclient_12_2_64bits\sdk;
C:\instantclient_12_2_32bits;
C:\instantclient_12_2_32bits\sdk;

hope this works!希望这有效!

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

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