Skip to content

Installing ROracle

jamespaultg edited this page Nov 20, 2018 · 15 revisions

After facing many issues installing ROracle, so summarizing the steps here that finally worked for me. Could be of use to someone

Install from ROracle BINARY file (the easiest option)

Download binary from oracle: http://www.oracle.com/technetwork/database/database-technologies/r/roracle/downloads/index.html

The run the following command in r, substituting the file path:

setwd('xxxxx') # set to path of download
install.packages('ROracle_1.2-1.zip', repos = NULL)

reference
https://stackoverflow.com/questions/18046324/how-to-install-roracle-package-on-windows-7


Install from ROracle SOURCE file

1. Ensure that Oracle client is installed

How to check: - you can check if the following folders are available(based on oracle version, your path might be slightly different)
"C:\\oracle64\\product\\11.2.0\\client_1\\oci\\include"
"C:\\oracle64\\product\\11.2.0\\client_1\\bin"\

Note: If you are using SQL developer to access Oracle database, that doesn't necessarily mean that you have Oracle client already installed.

check if environment variables OCI_INC, OCI_LIB64 are persent. If not, use the following(be sure to provide the correct location) code to set the environment variables from within R. You can also set the enivronment variables directly in Windows(via control panel)\

Sys.setenv(OCI_INC = "C:\\oracle64\\product\\11.2.0\\client_1\\oci\\include")
Sys.setenv(OCI_LIB64 = "C:\\oracle64\\product\\11.2.0\\client_1\\bin")\


  1. In R ensure that Devtools package is installed


  1. In R ensure that Rtools package is installed

How to check: find_rtools(), should return TRUE if your Rtools installation is successful You can refer this handy guide to install Rtools - http://jtleek.com/modules/01_DataScientistToolbox/02_10_rtools/#4

After installation, check if the windows environment variable PATH contains Rtools and gcc You can check from within R by
grepl("Rtools",Sys.getenv("PATH"))
Should return TRUE

You can check the path of Rtools as registered in the environment variable PATH by
grep("Rtools", strsplit(Sys.getenv("PATH"), ";")[[1]],value=TRUE)\

If it is not present/incorrect path then use the following code to add the PATH \

# If the rtools path is not added in the environment variable PATH
# use the below code to add it
rtools <- "C:\\Rtools\\bin"
mingw_32 <- "C:\\Rtools\\mingw_32\\bin"
mingw_64 <- "C:\\Rtools\\mingw_64\\bin"
path <- strsplit(Sys.getenv("PATH"), ";")[[1]]
new_path <- c(rtools, mingw_32, mingw_64, path)
new_path <- new_path[!duplicated(tolower(new_path))]
Sys.setenv(PATH = paste(new_path, collapse = ";"))


  1. In R ensure that DBI package is installed


  1. Finally you are now ready to install ROracle

install.packages("ROracle",type = 'source')


If you still face errors consult CRAN or this page http://nevilleandrade.blogspot.co.uk/2015/03/installing-and-using-roracle-in-r.html