安装ROracle

一、Linux mint
1、下载instantclient-basic-linux.x64-12.1.0.2.0.zip、instantclient-sdk-linux.x64-12.1.0.2.0.zip和instantclient-sqlplus-linux.x64-12.1.0.2.0.zip

2、
unzip instantclient-basic-linux.x64-12.1.0.2.0.zip
unzip instantclient-sqlplus-linux.x64-12.1.0.2.0.zip
unzip instantclient-sdk-linux.x64-12.1.0.2.0.zip

ln -s libclntsh.so.12.1 libclntsh.so
ln -s libocci.so.12.1 libocci.so

export LD_LIBRARY_PATH=$(pwd)

./sqlplus  #测试


3、R CMD INSTALL --configure-args='--with-oci-inc=/home/xuefliang/instantclient_12_1/sdk/include --with-oci-lib=/home/xuefliang/instantclient_12_1/' /home/xuefliang/ROracle_1.2-1.tar.gz

mkdir rdbms
cd rdbms
ln -s /home/xuefliang/Downloads/instantclient_12_1/sdk/include  public
cd ..
mkdir lib
#复制 instantclient_12_1 下所有文件到 lib目录
cp ./* ./lib

sudo vi /etc/ld.so.conf.d/oracle.conf && sudo chmod o+r /etc/ld.so.conf.d/oracle.conf

add the oracle library path

/usr/lib/oracle/12.1/client64/lib/

add the oracle library path

/home/xuefliang/Downloads/instantclient_12_1/lib

sudo ldconfig

Sys.setenv(ORACLE_HOME='/home/xuefliang/Downloads/instantclient_12_1')

install.packages("ROracle")

方式二:
sudo apt-get install alien

alien -i oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
alien -i oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
alien -i oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm

export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib/

sudo vi /etc/ld.so.conf.d/oracle.conf && sudo chmod o+r /etc/ld.so.conf.d/oracle.conf

add the oracle library path

/usr/lib/oracle/12.1/client64/lib/

sudo ldconfig

export ORACLE_HOME=/usr/lib/oracle/12.1/client64

sudo ln -s /usr/include/oracle/12.1/client64 $ORACLE_HOME/include

mkdir /usr/lib/oracle/12.1/client64/rdbms

sudo ln -s /usr/include/oracle/12.1/client64 $ORACLE_HOME/rdbms/public

sqlplus  sqlplus64 #测试

R CMD INSTALL --configure-args='--with-oci-inc=/usr/lib/oracle/12.1/client64/include --with-oci-lib=/usr/lib/oracle/12.1/client64/lib' /home/xuefliang/ROracle_1.2-1.tar.gz

Sys.setenv(ORACLE_HOME='/usr/lib/oracle/12.1/client64')
library(ROracle)

二、windows 10(64位)
1、下载并安装Rtools
2、环境变量-系统变量-Path中添加C:\Rtools\bin;C:\Rtools\gcc-4.6.3\bin;
3、下载并解压instantclient-basic-windows.x64-12.1.0.2.0.zip、instantclient-sdk-windows.x64-12.1.0.2.0.zip和instantclient-sqlplus-windows.x64-12.1.0.2.0.zip,解压到一个文件夹中instantclient_12_1中。
4、环境变量-系统变量添加OCI_INC C:\instantclient\x64\instantclient_12_1\sdk\include
OCI_LIB64 C:\instantclient\x64\instantclient_12_1\
5、安装DBI包
6、重启后(环境变量生效)
  cmd cd C:\Program Files\R\R-3.2.2\bin\x64

评论

此博客中的热门博文

V2ray websocket(ws)+tls+nginx分流

Rstudio 使用代理