This appendix presents the steps in a typical installation of Oracle R Enterprise on a Linux server and a Windows client. This appendix contains these topics:
Note:
This appendix describes an initial installation of Oracle R Enterprise. If Oracle R Enterprise components already exist on your client or server, refer to Upgrading Oracle R Enterprise.
About the server computer:
The server is running Oracle Linux 5.
The server has access to the internet and to Oracle public yum.
Oracle Database Enterprise Edition 12.1 is installed on the server.
Environment variables:
The Linux user ID of the installer:
To install Oracle R Enterprise on the server computer, first verify that Oracle Database is installed and that the environment is configured as specified in About the Oracle R Enterprise Sample Installation Environment. Next, complete these steps in the specified order:
Table A-1 Checklist for Oracle R Enterprise Server Requirements
Question | Sample Answer |
---|---|
What is the Linux version? |
% cat /etc/*-release Enterprise Linux Server release 6.4 |
Do you have access to the internet? |
Start a browser |
Can you log in as root? |
% sudo -s Password: --------- # # exit % |
Is Oracle Database installed? |
% SQLPLUS / as sysdba Copyright (c) 1982, 2015, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bitProduction With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options > exit % |
What is the value of |
% echo $ORACLE_HOME /myhome/product/12.1.0.1/dbhome_1 |
What is the value of |
% echo $ORACLE_SID orcl |
Does |
% echo $LD_LIBRARY_PATH /myhome/product/12.1.0.1/dbhome_1/lib:.... |
Does |
% echo $PATH /myhome/product/12.1.0.1/dbhome_1/bin:....... |
Are you a member of the dba group? |
% groups g102 dba |
Can you write to |
% ls -ld $ORACLE_HOME/lib drwxr-xr-x 3 myuser g102 12288 Jul 27 15:31 /myhome/product/12.1.0.1/dbhome_1/lib/ ... |
Oracle R Enterprise Server includes the rqsys
schema in Oracle Database and Oracle R Enterprise packages and shared libraries.
To install Oracle R Enterprise Server:
Verify the environment according to Table A-1.
Create an installation directory for the Oracle R Enterprise server components. The directory can have any name. For example:
/myhome/myoreserver/
Download the Oracle R Enterprise Server installation files and supporting packages from the Oracle R Enterprise Downloads page on the Oracle Technology Network:
Accept the license agreement and download the Oracle R Enterprise Server files for your platform to your installation directory.
Accept the license agreement and download the Oracle R Enterprise Supporting packages for your platform to your installation directory.
The installation directory now contains two zip files.
ore-server-linux-x86-64-1.5.zip ore-supporting-linux-x86-64-1.5.zip
Unzip the files.
unzip ore-server-linux-x86-64-1.5.zip unzip ore-supporting-linux-x86-64-1.5.zip
The installation directory looks like this after you unzip both files:
/myhome/myoreserver ore-server-linux-x86-64-1.5.zip ore-supporting-linux-x86-64-1.5.zip server.sh /server /supporting
Run server.sh
to perform a default installation of Oracle R Enterprise Server as shown in the following example. The script runs interactively. User input is shown in bold.
Note:
When the script displays [list]
in a prompt, you can press Enter to obtain a list of available items for your choice.
Example A-1 A Default, First-Time Installation of Oracle R Enterprise Server
hcearwig@myserver> ./server.sh -i Oracle R Enterprise 1.5 Server. Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved. Checking platform .................. Pass Checking R ......................... Pass Checking R libraries ............... Pass Checking ORACLE_HOME ............... Pass Checking ORACLE_SID ................ Pass Checking sqlplus ................... Pass Checking ORACLE instance ........... Pass Checking CDB/PDB ................... Pass Checking ORE ....................... Pass Choosing RQSYS tablespaces PERMANENT tablespace to use for RQSYS [list]: EXAMPLE SYSAUX SYSTEM USERS PERMANENT tablespace to use for RQSYS [list]: SYSAUX TEMPORARY tablespace to use for RQSYS [list]: TEMP TEMPORARY tablespace to use for RQSYS [list]: TEMP Choosing RQSYS password Password to use for RQSYS: XXXXXXX Choosing ORE user ORE user to use [list]: BI HR IX OE SCOTT SH ORE user to use [list]: ruser2 Choosing RUSER2 tablespaces PERMANENT tablespace to use for RUSER2 [list]: USERS TEMPORARY tablespace to use for RUSER2 [list]: TEMP Choosing RUSER2 password Password to use for RUSER2: Current configuration R Version ...................... Oracle Distribution of R version 3.2.0 (--) R_HOME ......................... /usr/lib64/R R_LIBS_USER .................... /product/12.1.0.1/dbhome_1/R/library ORACLE_HOME .................... /product/12.1.0.1/dbhome_1 ORACLE_SID ..................... orcl Existing R Version ............. None Existing R_HOME ................ None Existing ORE data .............. None Existing ORE code .............. None Existing ORE libraries ......... None RQSYS PERMANENT tablespace ..... SYSAUX RQSYS TEMPORARY tablespace ..... TEMP ORE user type .................. New ORE user name .................. RUSER2 ORE user PERMANENT tablespace ...USERS ORE user TEMPORARY tablespace .. TEMP Grant RQADMIN role ............. No Operation ........................ Install/Upgrade/Setup Proceed? [yes] y Removing R libraries ............... Pass Installing R libraries ............. Pass Installing ORE libraries ........... Pass Installing RQSYS data .............. Pass Configuring ORE .................... Pass Installing RQSYS code .............. Pass Installing ORE packages ............ Pass Creating ORE script ................ Pass Installing migration scripts ....... Pass Installing supporting packages ..... Pass Creating ORE user .................. Pass Granting ORE privileges ............ Pass Done
To install Oracle R Enterprise on the client computer, first verify that the Windows environment meets the requirements specified in About the Oracle R Enterprise Sample Installation Environment. Next, complete these steps:
To install Oracle R Enterprise on the Client:
Before installing Oracle R Distribution, verify that your version of Microsoft Windows is supported by Oracle R Enterprise and that you have access to the internet.
Follow these steps to install Oracle R Distribution on Windows:
Go to the Oracle Open Source Software Download page for Oracle R Distribution:
Under R 3.2.0 Downloads, select R Distribution for Windows 64 bit. Save the file on your computer.
ORD-3.2.0-win.zip
When you unzip the file, the executable file is extracted.
ORD-3.2.0-win.exe
Double-click the executable file to start the installation of Oracle R Distribution.
Follow the instructions to complete the installation.
Oracle R Enterprise requires Oracle Database Client. Instead of installing the full Database Client, which must be installed in an Oracle home directory, you can install Oracle Instant Client.
To download and install Oracle Instant Client, follow these steps:
Create an installation directory for the Oracle R Enterprise client components. The directory can have any name. For example:
c:\myoreclient
Navigate to the Oracle Database Instant Client page on the Oracle Technology Network:
http://www.oracle.com/technetwork/database/features/instant-client/
Select See Instant Client Downloads.
On the Instant Client Downloads page, select Instant Client for Microsoft Windows (x64).
Accept the license agreement.
Under Version 12.1.0.1.0, select Instant Client Package - Basic for Oracle Database 12.1.
Save the file in the installation directory that you created in Step 1. For example, if you choose the basic package, the following file is downloaded:
c:\myoreclient\instantclient-basic-windows.x64-12.1.0.1.0.zip
Unzip the file.
When you unzip the file, the instantclient_12_1
subdirectory is created. The contents of the installation directory are shown as follows:
myoreclient instantclient_12_1 vc10 vc11
Return to the Instant Client download page:
http://www.oracle.com/technetwork/topics/winx64soft-089540.html
Accept the license agreement and select Instant Client Package - SDK. Save the file in the directory that you created in Step 1.
c:\myoreclient\instantclient-sdk-windows.x64-12.1.0.1.0.zip
Unzip the file.
When you unzip the file, the sdk
subdirectory is created. The contents of the installation directory are shown as follows:
myoreclient instantclient_12_1 help sdk vc10 vc11
Add the full path of the Instant Client to the environment variables OCI_LIB64
and PATH
. The following steps set the variables to the path used in this example, c:\myoreclient\instantclient_12_1
:
In Windows Control Panel, choose System.
Click Advanced systems settings.
On the Advanced tab, click Environment Variables.
Under System variables, create OCI_LIB64
if it does not already exist. Set the value of OCI_LIB64
to c:\oreclient\instantclient_12_1
.
Under System variables, edit PATH
to include c:\oreclient\instantclient_12_1
.
Note:
The graphical user interface for creating environment variables may vary slightly, depending on your version of Windows.
To download the Oracle R Enterprise packages:
Navigate to the Oracle R Enterprise Downloads page on the Oracle Technology Network:
Accept the License Agreement.
Select the Client packages for Windows. Save the file in the installation directory that you created in Install Oracle Instant Client.
c:\myoreclient\ore-client-win-x86_64-1.5.zip
Unzip the file.
When you unzip the file, the client
subdirectory is created. The contents of the installation directory are shown as follows:
ORE_1.5.zip OREbase_1.5.zip OREcommon_1.5.zip OREdm_1.5.zip OREeda_1.5.zip OREembed_1.5.zip OREgraphics_1.5.zip OREmodels_1.5.zip OREpredict_1.5.zip OREstats_1.5.zip ORExml_1.5.zip
To install the Oracle R Enterprise packages from the R Console:
Start R from the Windows Start menu. If you have installed both 32 and 64-bit R, be sure to choose 64-bit R.
The R Console window is displayed, as shown in Example A-2
Install the packages as follows:
install.packages("c:/myoreclient/client/ORE_1.5.zip", repos=NULL) install.packages("c:/myoreclient/client/OREbase_1.5.zip", repos=NULL) install.packages("c:/myoreclient/client/OREcommon_1.5.zip", repos=NULL) install.packages("c:/myoreclient/client/OREdm_1.5.zip", repos=NULL) install.packages("c:/myoreclient/client/OREeda_1.5.zip", repos=NULL) install.packages("c:/myoreclient/client/OREembed_1.5.zip", repos=NULL) install.packages("c:/myoreclient/client/OREgraphics_1.5.zip", repos=NULL) install.packages("c:/myoreclient/client/OREmodels_1.5.zip", repos=NULL) install.packages("c:/myoreclient/client/OREpredict_1.5.zip", repos=NULL) install.packages("c:/myoreclient/client/OREstats_1.5.zip", repos=NULL) install.packages("c:/myoreclient/client/ORExml_1.5.zip", repos=NULL)
Each successful package installation produces this message in the R console:
package 'package_name' successfully unpacked and MD5 sums checked
To download the Oracle R Enterprise supporting packages:
Navigate to the Oracle R Enterprise Downloads page on the Oracle Technology Network:
Accept the License Agreement and select the Supporting packages for Windows. Save the file in the installation directory that you created in Install Oracle Instant Client.
c:\myoreclient\ore-supporting-win-x86_64-1.5.zip
Unzip the file.
When you unzip the file, the supporting
subdirectory is created. The contents of the installation directory are shown as follows:
arules_1.1-9.zip Cairo_1.5-8.zip DBI_0.3-1.zip png_0.1-7.zip randomForest_4.6-10.zip ROracle_1.2-1.zip statmod_1.4.21.zip
To install the supporting packages from the R Console:
Start R from the Windows Start menu. If you have installed both 32 and 64-bit R, be sure to choose 64-bit R.
The R Console window is displayed.
Install the packages as follows:
install.packages("c:/myoreclient/supporting/ROracle_1.1-12.zip", repos=NULL) install.packages("c:/myoreclient/supporting/DBI_0.2-7.zip", repos=NULL) install.packages("c:/myoreclient/supporting/png_0.1-7.zip", repos=NULL) install.packages("c:/myoreclient/supporting/Cairo_1.5-5.zip", repos=NULL) install.packages("c:/myoreclient/supporting/arules_1.1-3.zip", repos=NULL) install.packages("c:/myoreclient/supporting/statmod_1.4.20.zip", repos=NULL)
Each successful package installation produces this message in the R console:
package 'package_name' successfully unpacked and MD5 sums checked
To verify that the basic functionality of Oracle R Enterprise is working, establish a connection to Oracle R Enterprise Server, execute several basic commands, and run some of the Oracle R Enterprise demo programs.
Note:
To start and use Oracle R Enterprise, your user ID must have the privileges required for Oracle R Enterprise installation. See User Requirements for details.
Example A-2 Connecting to Oracle R Enterprise Server
To connect the Oracle R Enterprise Client to Oracle R Enterprise Server:
Select R x64 3.2.0 from the Windows Start menu.
The R Console is displayed.
Type this command to start Oracle R Enterprise:
> library(ORE)
Type this command to connect to the Oracle R Enterprise server. The following example connects user rquser
to the database orcl
on the server host serv1
using port 1521:
> ore.connect(user="rquser", sid="orcl", host="serv1", password="rquserpsw", port=1521, all=TRUE) Loading required package: ROracle Loading required package: DBI
Execute ore.is.connected
to validate the connection. If the connection is successful, the command returns TRUE
:
> ore.is.connected() [1] TRUE
Example A-3 Listing the Database Tables Accessible to RQUSER
The ore.ls
command lists the data sets that are available to the current user. For example, if TABLE1
and TABLE2
exist in the rquser
schema:
> ore.ls() [1] "TABLE1" "TABLE2"
Example A-4 Pushing an R Data Frame to a Database Table
The ore.push
command pushes an R data frame to a database table or a database table to an R data frame. For example:
> cars <- ore.push(cars)
Example A-5 Executing an Embedded R Function
The ore.doEval
command schedules execution of the specified function in the database-embedded R engine and returns the results.
> ore.doEval(function() { 123 }) [1] 123
Example A-6 Listing the Oracle R Enterprise Demo Scripts
The Oracle R Enterprise demo scripts are located in $ORACLE_HOME/R/library/ORE/demo
. The demo
command provides a list of available demos:
> demo(package="ORE") Demos in package 'ORE': aggregate Aggregation analysis Basic analysis & data processing operations basic Basic connectivity to database binning Binning logic columnfns Column functions cor Correlation matrix crosstab Frequency cross tabulations datastore DataStore operations datetime Date/Time operations derived Handling of derived columns distributions Distribution, density, and quantile functions do_eval Embedded R processing esm Exponential smoothing method freqanalysis Frequency cross tabulations glm Generalized Linear Models graphics Demonstrates visual analysis group_apply Embedded R processing by group hypothesis Hyphothesis testing functions matrix Matrix related operations nulls Handling of NULL in SQL vs. NA in R odm_ai Oracle Data Mining: attribute importance odm_ar Oracle Data Mining: association rules odm_dt Oracle Data Mining: decision trees odm_glm Oracle Data Mining: generalized linear models odm_kmeans Oracle Data Mining: enhanced k-means clustering odm_nb Oracle Data Mining: naive Bayes classification odm_nmf Oracle Data Mining: non-negative matrix factorization odm_oc Oracle Data Mining: o-cluster odm_svm Oracle Data Mining: support vector machines pca Principal Component Analysis push_pull RDBMS <-> R data transfer randomForest Random forest model rank Attributed-based ranking of observations reg Ordinary least squares linear regression row_apply Embedded R processing by row chunks sampling Random row sampling and partitioning of an ore.frame script Create, list, load, drop, grant, and revoke R scripts sql_like Mapping of R to SQL commands stepwise Stepwise OLS linear regression summary Summary functionality table_apply Embedded R processing of entire table
You can further verify the success of the installation by running some of the Oracle R Enterprise demo scripts. If a script runs to completion without errors, then the demo is successful.
Example A-7 Executing the aggregate Demo
This example shows the aggregate
demo with partial output.
> demo("aggregate", package="ORE") demo(aggregate) ---- ~~~~~~~~~ Type <Return> to start : > # > # O R A C L E R E N T E R P R I S E S A M P L E L I B R A R Y > # > # Name: aggregate.R > # Description: Demonstrates aggregations > # See also summary.R > # > # > # > > ## Set page width > options(width = 80) > # Push the built-in iris data frame to the database > IRIS_TABLE <- ore.push(iris) > # Display the class of IRIS_TABLE > class(IRIS_TABLE) [1] "ore.frame" attr(,"package") [1] "OREbase" > # Select count(Petal.Length) group by species > x = aggregate(IRIS_TABLE$Petal.Length, + by = list(species = IRIS_TABLE$Species), + FUN = length) > class(x) [1] "ore.frame" attr(,"package") [1] "OREbase" . . . .
Example A-8 Executing the row_apply Demo
This example shows the row_apply
demo with partial output.
> demo("row_apply", package="ORE") demo(row_apply) ---- ~~~~~~~~~ Type <Return> to start : > # > # O R A C L E R E N T E R P R I S E S A M P L E L I B R A R Y > # > # Name: row_apply.R > # Description: Execute R code on each row > # > # > > ## Set page width > options(width = 80) > # Push the built-in iris data frame to the database > IRIS_TABLE <- ore.push(iris) > # Display the class of IRIS_TABLE > class(IRIS_TABLE) [1] "ore.frame" attr(,"package") [1] "OREbase" > # Apply given R function to each row > ore.rowApply(IRIS_TABLE, + function(dat) { + # Any R code goes here. Operates on one row of IRIS_TABLE at + # a time + cbind(dat, dat$Petal.Length) + }) $`1` Sepal.Length Sepal.Width Petal.Length Petal.Width Species dat$Petal.Length 1 6.4 2.8 5.6 2.1 virginica 5.6 $`2` Sepal.Length Sepal.Width Petal.Length Petal.Width Species dat$Petal.Length 1 7.2 3 5.8 1.6 virginica 5.8 $`3` Sepal.Length Sepal.Width Petal.Length Petal.Width Species dat$Petal.Length 1 7.4 2.8 6.1 1.9 virginica 6.1 $`4` Sepal.Length Sepal.Width Petal.Length Petal.Width Species dat$Petal.Length 1 7.9 3.8 6.4 2 virginica 6.4 $`5` Sepal.Length Sepal.Width Petal.Length Petal.Width Species dat$Petal.Length 1 6.4 2.8 5.6 2.2 virginica 5.6 $`6` . . . .
Example A-9 Executing the cor Demo
This example shows the cor
demo with partial output.
> demo ("cor") demo(cor) ---- ~~~ Type <Return> to start : > # > # O R A C L E R E N T E R P R I S E S A M P L E L I B R A R Y > # > # Name: cor.R > # Description: Correlation matrix > # > # > # > > ## Set page width > options(width = 80) > # Push the built-in iris data frame to the database > IRIS_TABLE <- ore.push(iris) > # Display the class of IRIS_TABLE > class(IRIS_TABLE) [1] "ore.frame" attr(,"package") [1] "OREbase" > # Remove non numeric columns > iris_numeric = IRIS_TABLE[, c("Sepal.Length", "Sepal.Width", + "Petal.Length", "Petal.Width")] > # Pearson's correlation matrix > cor(iris_numeric, use = "all.obs") Sepal.Length Sepal.Width Petal.Length Petal.Width Sepal.Length 1.0000000 -0.1175698 0.8717538 0.8179411 Sepal.Width -0.1175698 1.0000000 -0.4284401 -0.3661259 Petal.Length 0.8717538 -0.4284401 1.0000000 0.9628654 Petal.Width 0.8179411 -0.3661259 0.9628654 1.0000000 . . . . Warning messages: 1: ORE object has no unique key - using random order 2: ORE object has no unique key - using random order 3: ORE object has no unique key - using random order 4: ORE object has no unique key - using random order
Example A-10 Executing the stepwise Demo
This example shows the stepwise
demo with partial output.
> demo("stepwise") demo(stepwise) ---- ~~~~~~~~ Type <Return> to start : > # > # O R A C L E R E N T E R P R I S E S A M P L E L I B R A R Y > # > # Name: stepwise.R > # Description: STEPWISE Multivariate Regression > # > # > # > > ## Set page width > options(width = 80) > # Push the built-in iris data frame to the database > IRIS_TABLE <- ore.push(iris) > # Display the class of IRIS_TABLE > class(IRIS_TABLE) [1] "ore.frame" attr(,"package") [1] "OREbase" > # Let us first project out the non numeric columns > IRIS_TABLE = IRIS_TABLE[, c("Sepal.Length", "Sepal.Width", + "Petal.Length", "Petal.Width")] > # Predict Sepal.Length based on the other 3 numeric columns > # Do it stepwise > model = ore.lm(Sepal.Length ~ ., data = IRIS_TABLE) > model Call: ore.lm(formula = Sepal.Length ~ ., data = IRIS_TABLE) Coefficients: (Intercept) Sepal.Width Petal.Length Petal.Width 1.8560 0.6508 0.7091 -0.5565 . . .