Oracle Machine Learning R Installation and Administration Guide
Oracle Machine Learning R Installation and Administration Guide
Oracle Machine Learning R Installation and Administration Guide
Release 1.5.1
E97849-11
September 2021
Oracle Machine Learning for R Installation and Administration Guide, Release 1.5.1
E97849-11
Contributors: Humberto Daniel Vazquez Blancarte, Mark Hornick, Sherry Lamonica, Korbinian Schmid, Qin
Wang
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse
engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is
prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on
behalf of the U.S. Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software,
any programs embedded, installed or activated on delivered hardware, and modifications of such programs)
and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end
users are "commercial computer software" or "commercial computer software documentation" pursuant to the
applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use,
reproduction, duplication, release, display, disclosure, modification, preparation of derivative works, and/or
adaptation of i) Oracle programs (including any operating system, integrated software, any programs
embedded, installed or activated on delivered hardware, and modifications of such programs), ii) Oracle
computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the
license contained in the applicable contract. The terms governing the U.S. Government’s use of Oracle cloud
services are defined by the applicable contract for such services. No other rights are granted to the U.S.
Government.
This software or hardware is developed for general use in a variety of information management applications.
It is not developed or intended for use in any inherently dangerous applications, including applications that
may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you
shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its
safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this
software or hardware in dangerous applications.
Oracle, Java, and MySQL are registered trademarks of Oracle and/or its affiliates. Other names may be
trademarks of their respective owners.
Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are
used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc,
and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered
trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content, products,
and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly
disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise
set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be
responsible for any loss, costs, or damages incurred due to your access to or use of third-party content,
products, or services, except as set forth in an applicable agreement between you and Oracle.
Contents
Preface
Technology Rebrand vii
Audience vii
Related Documents vii
Documentation Accessibility vii
Conventions viii
2 Install and Configure the Database for Oracle Machine Learning for R
Install Oracle Database for Oracle Machine Learning for R 2-1
Configure EXTPROC for Embedded R Execution 2-1
About EXTPROC 2-1
About EXTPROC Configuration for OML4R 2-2
Troubleshooting EXTPROC 2-3
iii
Install Oracle R Distribution on Linux 3-2
Install Oracle R Distribution on Oracle Linux Using Yum 3-3
Install Oracle R Distribution on Oracle Linux Using RPMs 3-6
Oracle R Distribution 3.3.0 RPMs for Oracle Linux 7 3-6
Oracle R Distribution 3.3.0 RPMs for Oracle Linux 6 3-6
Install Oracle R Distribution on Red Hat Enterprise Linux 3-7
Install Oracle R Distribution on Oracle Solaris 3-8
Install Oracle R Distribution on IBM AIX 3-9
Install Oracle R Distribution on Microsoft Windows 3-12
Configure Oracle R Distribution to Use MKL on the Client 3-12
Enable MKL Support for Oracle R Distribution on a Linux Client 3-12
Modifying the Number of Threads for MKL on Linux 3-13
Enable MKL Support for Oracle R Distribution on a Windows Client 3-13
Modify the Number of Threads for MKL on Windows 3-14
Uninstall Oracle R Distribution 3-14
Uninstall Oracle R Distribution on Windows 3-14
Uninstall Oracle R Distribution on Linux 3-14
Uninstalling Oracle R Distribution on Oracle Solaris 3-15
Uninstall Oracle R Distribution on IBM AIX 3-15
iv
Install OML4R Server in a Multitenant Environment 4-15
v
Performing a Full Uninstall 7-6
Uninstall OML4R Client 7-7
Install Additional R Packages on Linux or UNIX 7-7
Create a Database User for Oracle Machine Learning for R 7-7
About the RQADMIN Role 7-8
Create and Modify Environment Variables on Windows 7-9
Create an Oracle Wallet for an Oracle Machine Learning for R Connection 7-12
Control Memory Used by Embedded R 7-14
C Installing RStudio
About RStudio C-1
Install RStudio Server C-1
Install RStudio Desktop C-2
Index
vi
Preface
This document explains how to install and administer Oracle Machine Learning for R
(OML4R) Release 1.5.1.
Technology Rebrand
Oracle R Enterprise is now Oracle Machine Learning for R (OML4R).
Oracle has rebranded the suite of products and components that support machine learning
with Oracle Database and Big Data. This technology is now known as Oracle Machine
Learning (OML).
The OML application programming interface for R, previously under the name Oracle R
Enterprise, is now named Oracle Machine Learning for R (OML4R). The package, class, and
function names are not rebranded. They remain ORE, OREbase, ore.frame, ore.connect, and
so on.
The OML application programming interfaces for SQL include PL/SQL packages, SQL
functions, and data dictionary views. Using these APIs is described in publications, previously
under the name Oracle Data Mining, that are now named Oracle Machine Learning for SQL
(OML4SQL). The PL/SQL package and database view names are not rebranded. They
remain DBMS_DATA_MINING, ALL_MINING_MODELS, and so on.
The Oracle R Advanced Analytics for Hadoop (ORAAH) technology is now Oracle Machine
Learning for Spark (OML4Spark).
For more information, see Oracle Machine Learning.
Audience
This document is intended for anyone who is responsible for installing or administering
Oracle Machine Learning for R.
Installation of OML4R requires knowledge of R and knowledge of Oracle Database.
Related Documents
The Oracle Machine Learning for R documentation set includes the following publications.
• Oracle Machine Learning for R Release Notes
• Oracle Machine Learning for R Licensing Information User Manual
• Oracle Machine Learning for R User’s Guide
Documentation Accessibility
vii
Preface
Conventions
The following text conventions are used in this document.
Convention Meaning
boldface Boldface type indicates graphical user interface elements associated
with an action, or terms defined in text or the glossary.
italic Italic type indicates book titles, emphasis, or placeholder variables for
which you supply particular values.
monospace Monospace type indicates commands within a paragraph, URLs, code
in examples, text that appears on the screen, or text that you enter.
viii
Changes in Oracle Machine Learning for R
Installation and Administration Guide
Changes for OML4R Release 1.5.1.
Oracle has rebranded the suite of products and components that support machine learning
with Oracle Database and Big Data. This technology is now known as Oracle Machine
Learning (OML).
The OML application programming interface for R, previously under the name Oracle R
Enterprise, is now named Oracle Machine Learning for R (OML4R). The package, class, and
function names are not rebranded. They remain ORE, OREbase, ore.frame, ore.connect, and
so on.
arules 1.1-9
Cairo 1.5-8
DBI 0.5
png 0.1-7
randomForest 4.6-10
ROracle 1.3-1
statmod 1.4-21
ix
Changes in Oracle Machine Learning for R Installation and Administration Guide
See Also:
Install Oracle Machine Learning for R Client for details about the supporting
packages
Note:
R-3.6.1 has an OML4R 1.5.1 binary built under R-3.6.1 and is not compatible
with the OML4R 1.5.1 built under R-3.3.0.
See Also:
Install Oracle R Distribution on Linux in a Non-Default R_HOME
See Also:
Install R for Oracle Machine Learning for R for information about installing R
and Oracle R Distribution
x
1
Overview of Oracle Machine Learning for R
Installation
This chapter introduces the OML4R installation process. This chapter contains the following
topics:
1-1
Chapter 1
Client and Server Components of Oracle Machine Learning for R
Note:
If you intend to use both client and server components of OML4R on the
computer that is hosting Oracle Database, then you do not need to perform a
separate client installation. A local installation of Oracle Database Client is
automatically included in the installation of Oracle Database.
This figure illustrates the OML4R client and server installation steps.
1-2
Chapter 1
Oracle Machine Learning for R Installation Steps
Install R Install R
1-3
Chapter 1
Oracle Machine Learning for R Installation Steps
1-4
Chapter 1
Oracle Machine Learning for R System Requirements
Note:
Starting with R-3.6.1,
Linux 6 is no longer
supported.
The following table shows the supported configurations of OML4R Server components.
Oracle recommends that you use Oracle R Distribution, Oracle's free distribution of R, with
OML4R. You should install Oracle R Distribution before installing OML4R.
1-5
Chapter 1
Oracle Machine Learning for R System Requirements
Note:
The version of R must be the same on the server and on each client
computer. Also, the version of OML4R must be the same on the server and
on each client computer.
Note:
R-3.6.1 has an OML4R 1.5.1 binary built under R-3.6.1 and is not compatible
with the OML4R 1.5.1 built under R-3.3.0.
Note:
Starting with Oracle Database 18c, to install OML4R you must use the
installation scripts that come with the database. See Install Oracle Machine
Learning for R Server for Oracle Database 18c and Later.
Note:
In Oracle Database Release 12.1.0.2, for some embedded R operations to
be successful, Oracle R Enterprise releases 1.4.1 and later require the
database patch -- 20173897 WRONG RESULT OF GROUP BY FROM A
TABLE RETURNED BY EXTPROC (Patch).
1-6
Chapter 1
Oracle Machine Learning for R System Requirements
• On Windows 10:
– Hold down the Windows key and press I.
– In the Settings window, under Device specifications, find System type. This entry
shows whether the system is 64 bit.
• On other versions of Windows, refer to the Windows documentation to find out how to
display the bit version for your operating system.
Related Topics
• Oracle R Distribution and OML4R
Oracle recommends that you use Oracle R Distribution, Oracle's free distribution of R,
with OML4R.
1-7
2
Install and Configure the Database for Oracle
Machine Learning for R
This chapter explains how to install and configure Oracle Database to support OML4R
Server.
This chapter contains these topics:
Note:
You can install OML4R Server in a pluggable database (PDB) within a multitenant
container database (CDB). The database may not be the root database.
For information about managing a multitenant environment, see Oracle Database
Administrator's Guide.
About EXTPROC
When an application invokes an external procedure, Oracle Database starts an extproc
agent.
The application uses the network connection established by Oracle Database to pass
instructions to the agent for executing the procedure. The agent loads a DLL or shared
2-1
Chapter 2
Configure EXTPROC for Embedded R Execution
library, runs the external procedure, and passes back to the application any values
returned by the external procedure.
The following statement on a Linux or UNIX system sets EXTPROC_DLLS to execute only
external procedures for OML4R:
SET EXTPROC_DLLS=ONLY:$ORACLE_HOME/lib/ore.so
To allow extproc to service any external procedure, set EXTPROC_DLLS to ANY or simply
leave it blank (the default).
Enable extproc tracing by doing the following:
SET TRACE_LEVEL=ON
SET LD_LIBRARY_PATH=/usr/lib64/R/port/Linux-X64/lib
Note:
A database reboot is needed for changes in extproc.ora to take effect.
See Also:
"Default Configuration for External Procedures" in Oracle Database Net
Services Administrator's Guide for details
2-2
Chapter 2
Configure EXTPROC for Embedded R Execution
Troubleshooting EXTPROC
Calling an OML4R embedded R function may result in an error if a database configuration
problem exists.
If an attempt to call an OML4R embedded R function results in the following error, then the
external procedure did not succeed:
This error is often a database configuration problem. It may be caused by any of the
following:
• The OML4R user has not been granted RQADMIN role.
• The Oracle listener is not running,
• The Oracle listener configuration is incorrect, which may occur if the default external
procedure configuration (which is recommended) is not being used.
• Networking layer restrictions or issues exist.
• Restrictions on external procedure calls are in force.
2-3
3
Install R for Oracle Machine Learning for R
This chapter explains how to install R for OML4R.
This chapter contains these topics:
Related Topics
• Install Oracle Machine Learning for R on Exadata
Note:
The version of R must be the same on the server and on each client computer.
Also, the version of OML4R must be the same on the server and on each client
computer.
See Also:
About ROracle
ROracle is an open source R package that enables interaction between R and an Oracle
database.
ROracle is maintained and supported by Oracle.
ROracle is one of the open source supporting packages that is used by Oracle Machine
Learning for R. The supporting packages are introduced in Client and Server Components of
Oracle Machine Learning for R and described in Table 6-2.
3-1
Chapter 3
Install Oracle R Distribution on Linux
On UNIX systems, additional operating system packages may be required for R's
configuration and build process to succeed.
See Also:
The R Installation and Administration manual at R Manuals for information
about building R from source
3-2
Chapter 3
Install Oracle R Distribution on Linux
Note:
For Oracle Linux systems that have access to the internet, Oracle recommends
installing Oracle R Distribution from the Oracle Linux Yum Server.
[xxx_addons]
enabled=1
3-3
Chapter 3
Install Oracle R Distribution on Linux
Note:
If you are not using the most recent version of Oracle Linux and you
want to install dependent packages that are specific to your version, then
you must enable the corresponding Oracle Linux repository.
For example, to enable the Oracle Linux 6 base repository instead of the
latest repository, follow these steps:
a. Open the yum configuration file for the earlier version of Oracle Linux
in an editor.
/etc/yum.repos.d/public-yum-ol6.repo
b. Locate the section for Oracle Linux 6.
[ol6_base]
c. Change enabled=0 to enabled=1.
The result looks like this:
[ol6_base]
name=Oracle Linux $releasever installation media copy
($basearch)
baseurl=https://public-yum.oracle.com/repo/OracleLinux/OL6/
base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
4. Execute the yum install command to install R. Specify the version number to
install for Rversion. For example, to install R-3.6.1, use the command yum install
R-3.6.1.
# yum install R-Rversion
To install the most recent version of R that is available on Oracle public yum:
# yum install R.x86_64
Note:
Do not assume that the most recent version of R on Oracle public yum is
supported by your version of Oracle Machine Learning for R. Consult the
table of configuration requirements and server support in Oracle
Machine Learning for R System Requirements to determine which
version of R you should use.
5. On Linux 6, install the R-core-extra RPM; for rversion, specify the version of R that
you are installing:
3-4
Chapter 3
Install Oracle R Distribution on Linux
6. On Linux 6, set the LD_LIBRARY_PATH environment variable to the location of the R-core-
extra RPM.
For example, the default location of the R-core-extra RPM is /usr/lib64/R/port/Linux-
X64/lib. The following command sets LD_LIBRARY_PATH to the default location:
export LD_LIBRARY_PATH=/usr/lib64/R/port/Linux-X64/lib
On Linux 7, the required versions of these libraries are available natively so setting
LD_LIBRARY_PATH is not required.
Oracle Linux 7:
https://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/R-
Rversion.el7.x86_64.rpm
https://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/R-core-
Rversion.el7.x86_64.rpm
https://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/R-core-
extra-Rversion.el7.x86_64.rpm
https://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/R-devel-
Rversion.el7.x86_64.rpm
https://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/libRmath-
3-5
Chapter 3
Install Oracle R Distribution on Linux
Rversion.el7.x86_64.rpm
https://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/
libRmath-devel-Rversion.el7.x86_64.rpm
https://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/
libRmath-static-Rversion.el7.x86_64.rpm
https://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/
getPackage/R-3.3.0-2.el6.x86_64.rpm
https://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/
getPackage/R-core-3.3.0-2.el6.x86_64.rpm
https://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/
getPackage/R-core-extra-3.3.0-2.el6.x86_64.rpm
https://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/
getPackage/R-devel-3.3.0-2.el6.x86_64.rpm
https://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/
getPackage/libRmath-3.3.0-2.el6.x86_64.rpm
https://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/
getPackage/libRmath-devel-3.3.0-2.el6.x86_64.rpm
3-6
Chapter 3
Install Oracle R Distribution on Linux
https://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/
libRmath-static-3.3.0-2.el6.x86_64.rpm
Tip:
Rversion represents the version of Oracle R Distribution. Replace Rversion with the
R version you want to build. For example, replace Rversion with rpm -i /refresh/
home/rpmbuild/RPMS/x86_64/R-core-3.3.0-2.el6.x86_64.rpm for R-3.3.0.
Note:
If any dependencies are missing, install them as root.
# rpm -i path/rpmbuild/RPMS/R-Rversion.elx.x86_64.rpm
# rpm -i path/rpmbuild/RPMS/R-core-Rversion.elx.x86_64.rpm
# rpm -i path/rpmbuild/RPMS/libRmath-Rversion.elx.x86_64.rpm
# rpm -i path/rpmbuild/RPMS/libRmath-devel-Rversion.elx.x86_64.rpm
# rpm -i path/rpmbuild/RPMS/libRmath-static-Rversion.elx.x86_64.rpm
# rpm -i path/rpmbuild/RPMS/R-devel-Rversion.elx.x86_64.rpm
3-7
Chapter 3
Install Oracle R Distribution on Oracle Solaris
For example, this command installs R-3.3.0 on Red Hat Enterprise Linux x86-64
version 6, where the path to rpmbuild is /refresh/home/.
rpm -i /refresh/home/rpmbuild/RPMS/x86_64/R-
core-3.3.0-2.el6.x86_64.rpm
# install.sh installation_path
If you do not specify an installation path, then the default path is used. The default
path is:
• For Solaris SPARC: /usr/lib/sparcv9
• For Solaris Intel: /usr/lib/amd64
5. Uncompress the second file, either supporting-sol10-x86-64 or supporting-
sol10-sparc, to a local directory such as $ORACLE_HOME/lib. Add that directory
to $LD_LIBRARY_PATH.
These tar files contain the shared libraries for libR.so:
• libiconv.so.2
• libncurses.so.5
3-8
Chapter 3
Install Oracle R Distribution on IBM AIX
• libreadline.so.6
• libsunperf.so
libsunperf.so, Sun Performance Library, and its dependent shared libraries are
included in Oracle Solaris Studio.
6. Set environment variables as follows, where installation_path is the path to the directory
in which to install Oracle R Distribution:
• For ksh:
# export R_HOME=installation_path/R
# export PATH=$R_HOME/bin:$PATH
# export LD_LIBRARY_PATH=$R_HOME/lib:$LD_LIBRARY_PATH
• For csh:
# setenv R_HOME=installation_path/R
# setenv PATH=$R_HOME/bin:$PATH
# setenv LD_LIBRARY_PATH=$R_HOME/lib:$LD_LIBRARY_PATH
7. Run the following command to verify that libR.so is picking up its shared library
dependencies correctly from the local directory.
# ldd -r installation_path/R/lib/libR.so
8. Start R by typing R at the command prompt:
% R
uname -r
2. Download the files for your installation, where Rversion is 3.3.0.0 for R-3.3.0:
ord.Rversion-aix.tar.gz
ord-supporting-aix-Rversion.tar.gz
3-9
Chapter 3
Install Oracle R Distribution on IBM AIX
bash-4.2-5.aix5.1.ppc.rpm
bzip2-1.0.6-1.aix5.1.ppc.rpm
bzip2-devel-1.0.6-1.aix5.1.ppc.rpm
cairo-1.10.0-1.aix5.2.ppc.rpm
curl-7.28.1-1.aix5.1.ppc.rpm
curl-devel-7.28.1-1.aix5.1.ppc.rpm
expat-2.0.1-3.aix5.1.ppc.rpm
fontconfig-2.5.0-1.aix5.1.ppc.rpm
gettext-0.17-1.aix5.1.ppc.rpm
glib2-2.28.6-1.aix5.1.ppc.rpm
info-4.13a-2.aix5.1.ppc.rpm
libiconv-1.14-1.aix5.1.ppc.rpm
libidn-1.29-1.aix5.1.ppc.rpm
libidn-devel-1.29-1.aix5.1.ppc.rpm
libpng-1.5.9-1.aix5.1.ppc.rpm
libpng-devel-1.5.9-1.aix5.1.ppc.rpm
libssh2-1.4.3-2.aix5.1.ppc.rpm
libssh2-devel-1.4.3-2.aix5.1.ppc.rpm
openldap-2.4.23-0.3.aix5.1.ppc.rpm
openldap-devel-2.4.23-0.3.aix5.1.ppc.rpm
openssl-1.0.1p-1.aix5.1.ppc.rpm
openssl-devel-1.0.1p-1.aix5.1.ppc.rpm
pcre-8.35-1.aix5.1.ppc.rpm
pcre-devel-8.35-1.aix5.1.ppc.rpm
pixman-0.28.2-1.aix5.1.ppc.rpm
pkg-config-0.25-2.aix5.1.ppc.rpm
readline-6.2-3.aix5.1.ppc.rpm
readline-devel-6.2-3.aix5.1.ppc.rpm
texinfo-4.13a-2.aix5.1.ppc.rpm
xrender-0.9.1-3.aix5.2.ppc.rpm
xz-devel-5.0.7-1.aix5.1.ppc.rpm
xz-libs-5.0.7-1.aix5.1.ppc.rpm
zlib-1.2.6-1.aix5.1.ppc.rpm
zlib-devel-1.2.6-1.aix5.1.ppc.rpm
You can also download these RPMs from AIX Open Source Packages.
4. Install the RPMs as root using an rpm command:
$ cd /download_directory/ord-supporting-aix-Rversion
$ su
# rpm -i *.rpm
3-10
Chapter 3
Install Oracle R Distribution on IBM AIX
$ export LIBPATH=/opt/freeware/lib64:/opt/freeware/lib:$LIBPATH
• For csh:
$ gunzip ord.Rversion-aix.tar.gz
$ tar -xf ord.Rversion-aix.tar
Option Description
ORD Install all of the filesets in Oracle R Distribution.
ORD.core Installs only the ORE.core fileset.
ORD.devel Installs only the ORE.devel fileset, which requires the ORE.core fileset.
The following command installs all of the filesets using the specified path:
$ export PATH=installation_path/usr/bin:$PATH
3-11
Chapter 3
Install Oracle R Distribution on Microsoft Windows
• For csh:
9. Run ldd to ensure that shared library dependencies were picked up correctly:
$ ldd installation_path/usr/lib/R/bin/exec/R
$ ldd installation_path/usr/lib/R/lib/libR.so (libiconv,
libreadline)
$ ldd installation_path/usr/lib/R/lib/libRlapack.so
$ ldd installation_path/usr/lib/R/lib/libRblas.so
3-12
Chapter 3
Configure Oracle R Distribution to Use MKL on the Client
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:
/path_to/libmkl_rt.so:
${RHOME}/lib:
${ORACLE_HOME}/lib
3. Start R and execute the Sys.BlasLapack function:
Sys.BlasLapack()
$vendor
[1] "Intel Math Kernel Library (Intel MKL)"
$nthreads
[1] -1
The returned value of $vendor indicates that MKL has replaced the BLAS and LAPACK that are
native to R.
The returned value of nthreads indicates the number of threads to be used by MKL. By
default all available threads are used ($nthreads= -1).
Note:
In a typical installation of Oracle R Distribution, libOrdBlasLoader.dll is
located in the R home directory:
C:\Program Files\R\R-version\bin\x64
3-13
Chapter 3
Uninstall Oracle R Distribution
If MKL_NUM_THREADS does not exist, then you must create it as described in:
3-14
Chapter 3
Uninstall Oracle R Distribution
rpm -e R-3.3.0-2.el7
rpm -e R-devel
rpm -e R-core
rpm -e R-core-extra
rpm -e libRmath-devel
rpm -e libRmath
rpm -e libRmath-static
./uninstall.sh installation_path
Note:
If you do not specify the installation path, then the following default path is used:
• For Solaris SPARC: /usr/lib/sparcv9
• For Solaris Intel: /usr/lib/amd64
3-15
Chapter 3
Uninstall Oracle R Distribution
Option Description
ORD Uninstall all of the filesets in Oracle R Distribution.
ORD.core Uninstalls only the ORE.core fileset.
ORD.devel Uninstall only the ORE.devel fileset.
The following command uninstalls all of the filesets using the specified path:
3-16
4
Install Oracle Machine Learning for R Server
This chapter explains how to install and administer OML4R Server. This chapter includes
these topics:
Related Topics
• Install Oracle Machine Learning for R on Exadata
Note:
The version of OML4R must be the same on the server and on each client
computer. Also, the version of R must be the same on the server and on each client
computer.
See Also:
4-1
Chapter 4
About Oracle Machine Learning for R Server
4-2
Chapter 4
Oracle Machine Learning for R Server Requirements
System Requirements
Lists the system requirements for OML4R Server.
• The operating system must conform to the requirements specified in Oracle Machine
Learning for R System Requirements.
• Oracle Database must be installed and configured as described in Install and Configure
the Database for Oracle Machine Learning for R.
Note:
You can install OML4R Server in a pluggable database (PDB) in a multitenant
environment. See Oracle Database Administrator's Guide.
Environment Variables
Lists the environment variables required by OML4R Server.
Table 4-1 Environment Variable Requirements for Oracle Machine Learning for R
Server
4-3
Chapter 4
Oracle Machine Learning for R Server Requirements
Table 4-1 (Cont.) Environment Variable Requirements for Oracle Machine Learning
for R Server
User Requirements
Lists the requirements for the operating system user who installs OML4R Server.
4-4
Chapter 4
Install Oracle Machine Learning for R Server for Oracle Database 18c and Later
See Also:
To determine the group membership of your Linux or UNIX user ID, type this command:
% groups
dba othergroup
The rqcfg.sql script enables the OML4R Server components that are part of the database,
configures some aspects of the server, and installs some OML4R database objects.
Before installing OML4R Server, install R, as described in Install R for Oracle Machine
Learning for R .
The OML4R Server packages are in the $ORACLE_HOME/R/library/ directory. For Oracle
Database 18c and 19c, the server packages in Oracle Database are built under R-3.3.0 and
are compatible with R-3.3.0. If you are using R-3.3.0, you can install OML4R Server by
running the rqcfg.sql installation script.
For use with R-3.6.1 or later, the OML4R Server packages are built under R-3.6.1. To use
OML4R with R-3.6.1, you must download and install those OML4R Server packages before
running the rqcfg.sql installation script.
4-5
Chapter 4
Install Oracle Machine Learning for R Server for Oracle Database 18c and Later
Note:
Use the rqcfg.sql script only once, to enable and configure OML4R Server
for the first time. Do not run the script on an existing OML4R installation for
maintenance or upgrades. For example, if you are using R-3.3.0 with OML4R
1.5.1 but you want to upgrade to R-3.6.1, do not run the rqcfg.sql script
again.
$ cd $ORACLE_HOME/R/library
$ mv ORE ORE.orig
$ mv OREbase OREbase.orig
$ mv OREcommon OREcommon.orig
$ mv OREdm OREdm.orig
$ mv OREdplyr OREdplyr.orig
$ mv OREeda OREeda.orig
$ mv OREembed OREembed.orig
$ mv OREgraphics OREgraphics.orig
$ mv OREmodels OREmodels.orig
$ mv OREpredict OREpredict.orig
$ mv OREserver OREserver.orig
$ mv OREstats OREstats.orig
$ mv ORExml ORExml.orig
2. Go to the Oracle Machine Learning for R Downloads page, accept the license
agreement, and download the R-3.6.1 compatible OML4R Server packages to an
installation directory, such as /oml4rserver_install_dir/.
Note:
Use the same installation directory for all OML4R components.
$ cd /oml4rserver_install_dir/
$ unzip ore-server-platform-arch-version.zip
4-6
Chapter 4
Install Oracle Machine Learning for R Server for Oracle Database 18c and Later
When you unzip the file, the /server directory is created and these files are extracted to
it:
/server/ORE_version_R_arch-unknown-platform-gnu.tar.gz
/server/OREbase_version_R_arch-unknown-platform-gnu.tar.gz
/server/OREcommon_version_R_arch-unknown-platform-gnu.tar.gz
/server/OREdm_version_R_arch-unknown-platform-gnu.tar.gz
/server/OREdplyr_version_R_arch-unknown-platform-gnu.tar.gz
/server/OREeda_version_R_arch-unknown-platform-gnu.tar.gz
/server/OREembed_version_R_arch-unknown-platform-gnu.tar.gz
/server/OREgraphics_version_R_arch-unknown-platform-gnu.tar.gz
/server/OREmodels_version_R_arch-unknown-platform-gnu.tar.gz
/server/OREpredict_version_R_arch-unknown-platform-gnu.tar.gz
/server/OREserver_version_R_arch-unknown-platform-gnu.tar.gz
/server/OREstats_version_R_arch-unknown-platform-gnu.tar.gz
/server/ORExml_version_R_arch-unknown-platform-gnu.tar.gz
$ cd /oml4rserver_install_dir/server
If you are installing OML4R Server for the first time, then run the rqcfg.sql script. If you
already have installed OML4R Server and are upgrading R from R-3.3.0 to R-3.6.1, then you
do not need to, and should not, run the rqcfg.sql script.
Argument Description
define permtbl Specify a permanent tablespace for the RQSYS schema.
define temptbl Specify a temporary tablespace.
4-7
Chapter 4
Install Oracle Machine Learning for R Server for Oracle Database 12c and Earlier
Argument Description
define orahome Specify the ORACLE_HOME directory.
define rhome Specify the R_HOME directory.
1. At your operating system prompt, start SQL*Plus, log in to your PDB directly and
run the rqcfg.sql script. To capture the log, spool the installation steps to an
external file. The following example uses the PDB PDB1 and gives example values
for the script arguments.
$ sqlplus / as sysdba
SQL> spool install.txt
SQL> alter session set container=PDB1;
SQL> ALTER PROFILE DEFAULT LIMIT PASSWORD_VERIFY_FUNCTION NULL;
SQL> @$ORACLE_HOME/R/server/rqcfg.sql
cd $ORACLE_HOME/bin
chmod 755 ORE
3. Download and install the OML4R 1.5.1 supporting packages for your system as
described in Install the OML4R Supporting Packages
Related Topics
• Uninstall OML4R Server from Oracle Database 18c or Later
How to uninstall OML4R from Oracle Database Release 18c or later.
Note:
To install OML4R Server without needing to respond to visual prompts, use a
batch mode installation such as that described in A Default Batch Installation.
4-8
Chapter 4
Install Oracle Machine Learning for R Server for Oracle Database 12c and Earlier
The installation directory looks like this after you unzip both files:
For Linux or UNIX:
/oml4r_server_install_dir
ore-server-platform-arch-version.zip
ore-supporting-platform-arch-version.zip
server.sh
/server
/supporting
For Windows:
\oml4r_server_install_dir
ore-server-platform-arch-version.zip
ore-supporting-platform-arch-version.zip
server.bat
\server
\supporting
5. For Linux or UNIX, run server.sh. For Windows, run server.bat. The script performs a
default, first-time installation of OML4R Server, as described in A Default Interactive
Installation. For details about the server script, see About the Server Script.
For Linux or UNIX:
./server.sh
For Windows:
server.bat
4-9
Chapter 4
Install Oracle Machine Learning for R Server for Oracle Database 12c and Earlier
Note:
Beginning in R-3.3.0, on an Oracle Linux 6 system, it is necessary to set
LD_LIBRARY_PATH in $ORACLE_HOME/hs/admin/extproc.ora to the location of
the R-core-extra RPM so that these libraries are found by the Oracle process
running extproc. On Linux systems, the default location of the R-core-extra
RPM is /usr/lib64/R/port/Linux-X64/lib. In extproc.ora, enter:
SET LD_LIBRARY_PATH=/usr/lib64/R/port/Linux-X64/lib
For changes in extproc.ora to take effect, you must stop and restart the
database.
This procedure is not necessary on a Linux 7 system, as the required
versions of the libraries provided by the R-core-extra RPM are available
natively..
See Also:
Example A-1 for an example with output
4-10
Chapter 4
Install Oracle Machine Learning for R Server for Oracle Database 12c and Earlier
Note:
You can use the server script to install the supporting packages and create users,
or you can choose to perform these tasks separately, as described in the following
sections:
• Install the OML4R Supporting Packages
• Create a Database User for Oracle Machine Learning for R
The script can be run in interactive mode, in batch mode, or in hybrid mode. If you run the
script without arguments, it installs or upgrades OML4R Server in interactive mode; it
attempts to install the supporting packages; and it creates or configures a database user.
The command-line arguments for the server script are described in the following table. The
arguments for the script are the same for Linux, UNIX, and Windows. You can obtain a listing
of the arguments with brief descriptions by executing the following on a Linux or UNIX
system:
./server.sh -h
or
./server.sh --help
On a Windows system, you can obtain a listing of the arguments with brief descriptions by
executing the following:
server.bat -h
or
server.bat --help
4-11
Chapter 4
Install Oracle Machine Learning for R Server for Oracle Database 12c and Earlier
Argument Description
-i, --install Install or upgrade OML4R Server.
An installation or upgrade includes the following by default:
• Installation of the supporting packages if they are present.
• Creation or configuration of a database user if one does not exist.
-u, --uninstall Uninstall OML4R Server:
• When used with --keep (the default), the script removes the
RQSYS metadata and PL/SQL packages from the database but
retains the libraries and R packages under Oracle home (partial
uninstall).
• When used with --full, the script removes the libraries and R
packages under Oracle home in addition to the RQSYS metadata
and PL/SQL packages in the database. (full uninstall).
See Uninstall Oracle Machine Learning for R.
-s, --setup-user Create or configure a database user for OML4R (the default).
-y Never prompt.
--ask Interactive mode (the default).
--keep When uninstalling OML4R Server, keep the R packages and libraries
under Oracle home but remove the database objects. Allows OML4R
support to be removed from a single database instance or pluggable
database (PDB) without affecting other databases in Oracle home.
See Performing a Partial Uninstall.
--full When uninstalling OML4R Server, remove the R packages and
libraries under Oracle home in addition to the database objects.
See Performing a Full Uninstall.
--no-supp When combined with --install, prevents installation of the
supporting packages. By default the supporting packages are installed
if they are available.
--supp Install supporting packages (the default).
--pdb NAME The name of a pluggable database (PDB) in a multitenant container
database (CDB).
Multitenant architecture enables an Oracle database to function as a
container database that includes zero, one, or many pluggable
databases. For information about multitenant architecture, see Oracle
Database Concepts.
--perm PERM Permanent tablespace for RQSYS.
--temp TEMP Temporary tablespace for RQSYS.
--user-perm PERM Permanent tablespace for OML4R user.
--user-temp TEMP Temporary tablespace for OML4R user.
--user USER OML4R database user name.
See the following topics for examples of using the server script:
4-12
Chapter 4
Verify the OML4R Server Installation
See Also:
Example A-1 for an example with output
For Windows:
server.bat
For Windows:
server.bat -y --install --setup-user --perm SYSAUX --temp TEMP
--user-perm USERS --user-temp TEMP --user OML_USER
For any installation, you can execute some functions to verify a successful installation.
4-13
Chapter 4
Verify the OML4R Server Installation
If there are problems with the installation and you are unable to resolve them, you can
request help from My Oracle Support or from the R Technologies in Data
Warehousing.
Example 4-1 Run Examples to Verify the Server Installation
First execute these commands from an R instance directly on the database server and
then execute them from the OML4R client.
Start R using the ORE script and load the ORE library.
% ORE
> library(ORE)
4-14
Chapter 4
Install OML4R Server in a Multitenant Environment
model.
example("ore.doEval") ## Runs an embedded R execution function.
Related Topics
• Connect OML4R Client to OML4R Server
Instructions for connecting to an OML4R server.
See Also:
• Oracle Machine Learning for R User’s Guide for information about connecting
to a pluggable database.
• Oracle Database Concepts for an introduction to multitenant architecture.
• Oracle Database Administrator's Guide for information about managing a
multitenant environment.
4-15
5
Install Oracle Machine Learning for R on
Exadata
This chapter explains how to install Oracle R Distribution and OML4R Server on Oracle
Exadata Database Machine. This chapter includes these topics:
Note:
The version of OML4R must be the same on the server and on each client
computer. Also, the version of R must be the same on the server and on each client
computer. See the Oracle Machine Learning for R Configuration Requirements and
Server Support Matrix for supported configurations.
5-1
Chapter 5
Install Oracle Machine Learning for R on Exadata Using DCLI
See Also:
For more details about DCLI, go to the My Oracle Support website, log in
with your Customer Support Identifier, and type DCLI in the search box.
Return values:
0 -- file or command was copied and executed successfully on all cells
1 -- one or more cells could not be reached or remote execution returned
non-zero status.
2 -- An error prevented any command execution
Examples:
dcli -g mycells -k
dcli -c stsd2s2,stsd2s3 vmstat
dcli -g mycells cellcli -e alter iormplan active
dcli -g mycells -x reConfig.scl
options:
--version show program's version number and exit
-c CELLS comma-separated list of cells
-d DESTFILE destination directory or file
-f FILE file to be copied
5-2
Chapter 5
Install Oracle Machine Learning for R on Exadata Using DCLI
Important:
Before beginning the installation, review the instructions for installing Oracle R
Distribution in Install R for Oracle Machine Learning for R .
This command generates public and private key files in the .ssh subdirectory of the
home directory of the root user.
b. In a text editor, create a file that contains the names of all the compute nodes in the
rack. Specify each node name on a separate line. For example, the nodes file for a 2-
node cluster could contain entries like the following:
$ cat nodes
exadb01
exadb02
c. Run the DCLI command with the -k option to establish SSH trust across all the
nodes. The -k option causes DCLI to contact each node sequentially (not in parallel)
and prompts you to enter the password for each node.
$ dcli -t -g nodes -l root -k -s "\-o StrictHostkeyChecking=no"
5-3
Chapter 5
Install Oracle Machine Learning for R on Exadata Using DCLI
DCLI with -k establishes SSH Trust and User Equivalence. Subsequent DCLI
commands will not prompt for passwords.
2. Install Oracle R Distribution using yum if an internet connection is available.
Otherwise, install the Oracle R Distribution and operating system dependencies
manually. Request the file ord-linux-x86_64-Rversion-Exadataversion.tar.gz
from Oracle Support, where Rversion is the version of Oracle R Distribution to
install and Exadataversion is your Exadata version number.
a. Log in to My Oracle Support.
b. Click Contact Us.
c. If yum and internet access are unavailable, request access to this file through
My Oracle Support.
ord-linux-x86_64-Rversion-Exadataversion.tar.gz
d. When permission is granted, log in as root to any compute node and download
the file.
3. Create a directory and replicate the downloaded file in this directory across all
nodes. For example, the following commands create the directory /home/
oracle/ORD and replicate the file ord-linux-x86_64-Rversion-
Exadataversion.tar.gz in this directory.
$ dcli -t -g nodes -l root mkdir -p /home/oracle/ORD
$ dcli -t -g nodes -l root -f
ord-linux-x86_64-Rversion-Exadataversion.tar.gz -d
/home/oracle/ORD/ord-linux-x86_64-Rversion-Exadataversion.tar.gz
4. Uncompress and untar the file to replicate the dependent RPMs across all nodes.
$ dcli -t -g nodes -l root tar xvfz
/home/oracle/ORD/ord-linux-x86_64-Rversion-Exadataversion.tar.gz
-C /home/oracle/ORD
$ ls /home/oracle/ORD/ord-linux-x86_64-Rversion-Exadataversion.tar.gz
Alternatively, you can download these RPMs from the Oracle public yum server.
The locations of the RPMs are listed in "Install Oracle R Distribution on Oracle
Linux Using RPMs".
5. To install the new RPMs and update existing RPMs across nodes, execute the
following RPM command:
$ dcli -t -g nodes -l root rpm -i --force
/home/oracle/ORD/ord-linux-x86_64-Rversion-Exadataversion/*.rpm
For each node, the following command returns the output shown.
$ dcli -g nodes -l oracle R --vanilla
...
exadb01: R is free software and comes with ABSOLUTELY NO WARRANTY.
exadb01: You are welcome to redistribute it under certain conditions.
exadb01: Type 'license()' or 'licence()' for distribution details.
5-4
Chapter 5
Install Oracle Machine Learning for R on Exadata Using DCLI
exadb01:
exadb01: Natural language support but running in an English locale
exadb01:
exadb01: R is a collaborative project with many contributors.
exadb01: Type 'contributors()' for more information and
exadb01: 'citation()' on how to cite R or R packages in publications.
exadb01:
exadb01: Type 'demo()' for some demos, 'help()' for on-line help, or
exadb01: 'help.start()' for an HTML browser interface to help.
exadb01: Type 'q()' to quit R.
exadb01:
exadb01: You are using Oracle's distribution of R. Please contact
exadb01: Oracle Support for any problems you encounter with this
exadb01: distribution.
Install OML4R Server Across Exadata Compute Nodes Using DCLI for 12c
and Earlier
How to use DCLI to install OML4R Server across multiple Exadata Linux compute nodes for
Oracle Database 12c and Earlier.
The DCLI commands are summarized in DCLI Commands Summary for Oracle Machine
Learning for R Server.
Note:
Before beginning the installation, review the instructions for installing OML4R
Server in Install Oracle Machine Learning for R Server .
5-5
Chapter 5
Install Oracle Machine Learning for R on Exadata Using DCLI
To install OML4R Server on Exadata using DCLI for Oracle Database 12c and
earlier, follow these steps:
1. Ensure that the ORACLE_HOME, ORACLE_SID, R_HOME, PATH, and LD_LIBRARY_PATH
environment variables are properly set on each node, and are defined in the same
shell where the DCLI script will run. For example, you could specify values like the
following in a bashrc file:
export ORACLE_HOME=/hostname/app/oracle/product/release_number/dbhome_1
export ORACLE_SID=ORCL
export R_HOME=/usr/lib64/R
export PATH=$PATH:$R_HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:$RHOME_lib:$R_HOME/
port/Linux-X64/lib
2. Go to the Oracle Machine Learning for R Downloads website.
On the Downloads page, in the Linux 64-bit row, select Server, accept the license
agreement, and download the file. To download the supporting packages, select
Supporting, accept the license agreement, and download the file. The following
files are downloaded for OML4R, where version is the OML4R, release number.
ore-server-linux-x86-64-version.zip
ore-supporting-linux-x86-64-version.zip
3. Log in as root, and copy the installers for OML4R Server and the supporting
packages across nodes. For example:
$ dcli -g nodes -l oracle mkdir -p /home/oracle/OML4R
$ dcli -g nodes -l oracle -f ore-server-linux-x86-64-version.zip -d
/home/oracle/OML4R/ore-server-linux-x86-64-version.zip
$ dcli -g nodes -l oracle -f ore-supporting-linux-x86-64-version.zip -d
/home/oracle/OML4R/ore-supporting-linux-x86-64-version.zip
4. Unzip the OML4R Server bundle on each node:
5-6
Chapter 5
Install Oracle Machine Learning for R on Exadata Using DCLI
Note:
The server script creates a user for OML4R. By default, the script does not
grant the RQADMIN role to the user.
Any OML4R user can execute embedded R, but only those with the RQADMIN
role can create and drop the R scripts in the database. Use caution when
granting the RQADMIN role.
For more information about the role, see About the RQADMIN Role.
See Also:
Verify the OML4R Server Installation
Install OML4R Server Across Exadata Compute Nodes Using DCLI for 18c
and Later
How to use DCLI to install OML4R Server across multiple Exadata Linux compute nodes for
Oracle Database 18c and later.
To install OML4R Server on Exadata using DCLI for Oracle Database 18c and later, follow
these steps:
1. Get a list of the compute nodes in the rack.
In the following example, the cat nodes command lists the nodes for a two-node cluster.
$ cat nodes
exadb01
exadb02
5-7
Chapter 5
Install Oracle Machine Learning for R on Exadata Using DCLI
2. In a text editor, create a file that contains the names of all of the compute nodes in
the rack. Specify each node name on a separate line. For example, the nodes file
for a two-node cluster would contain entries such as the following:
exadb01
exadb02
export ORACLE_HOME=/u01/app/oraclecle/product/release_number/
dbhome_1
export ORACLE_SID=ORCL
export R_HOME=/usr/lib64/R
export PATH=$PATH:$R_HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/
lib:$RHOME_lib:$R_HOME/port/Linux-X64/lib
4. Option 1: On the first database node only, execute as sysdba the rqcfg.sql script
from your PDB.
$ sqlplus / as sysdba;
SQL> alter session set container=PDBNAME;
SQL> @$ORACLE_HOME/R/server/rqcfg.sql
Note:
The rqcfg.sql script ships with Oracle Database 18c and later and
resides in the $ORACLE_HOME/R/server directory. The script installs the
OML4R Server components in the database and you only need to be
execute it once.
The rqcfg.sql script prompts you for the following input parameters:
Option 2: Execute the rqcfg.sql script from the Linux command line.
In the example, the user is system with the password apassword, the RQSYS
schema is in SYSAUX and SYSAUX is assigned the temporary tablespace TEMP.
The value for ORACLE_HOME is /u01/app/oracle/product/18.0.0.0/dbhome_1 and
the value for R_HOME is the Linux default path, /usr/lib64/R:
5-8
Chapter 5
Install Oracle Machine Learning for R on Exadata Using DCLI
Note:
The rqcfg.sql script creates an OML4R user. By default, the script does not
grant the RQADMIN role to the user.
Any OML4R user can use an embedded R execution function, but only those
with the RQADMIN role can create and drop the R scripts in the OML4R script
repository in the database. Use caution when granting the RQADMIN role.
$ ORE
> library(ORE)
Loading required package: OREbase
Attaching package: OREbase
The following objects are masked from âpackage:baseâ:
cbind, data.frame, eval, interaction, order, paste, pmax, pmin,
rbind, table
Loading required package: OREembed
Loading required package: OREstats
Loading required package: MASS
Loading required package: OREgraphics
Loading required package: OREeda
Loading required package: OREmodels
Loading required package: OREdm
5-9
Chapter 5
Install Oracle Machine Learning for R for Oracle RAC Without DCLI
Related Topics
• Security Best Practices for OML4R
To minimize the risk of compromising the security of an OML4R Server in Oracle
Database, Oracle recommends the following security best practices.
5-10
Chapter 5
Install Oracle Machine Learning for R for Oracle RAC Without DCLI
2. Start SQL*Plus, log in to your PDB directly and run the rqcfg.sql script. The following
example uses the PDB PDB1 and gives example values for the script arguments.
3. At your operating system prompt, go to the ORACLE_HOME/bin directory and grant read
and execute permission to all users to the ORE directory.
cd $ORACLE_HOME/bin
chmod 755 ORE
4. Create a directory to contain the OML4R 1.5.1 supporting packages for your system and
change directories to it. To that directory, download the supporting package zip file as
described in Install the OML4R Supporting Packages.
5. Extract the supporting packages.
6. For each package, at your operating system command prompt, run the following
command.
Note:
You can perform steps 2 and 3 simultaneously by first extracting the OML4R
supporting packages bundle in the same directory from which you execute the
server.sh script. (For Microsoft Windows, the script is server.bat.)
1. Install Oracle R Distribution. See Install R for Oracle Machine Learning for R .
2. Execute the server.sh script from the OML4R Server installer bundle. See Install Oracle
Machine Learning for R Server
3. Install the OML4R supporting packages. See Install Oracle Machine Learning for R
Server for Oracle Database 12c and Earlier
When you execute the server.sh script on node 1, it installs the OML4R packages on the
operation system in the $ORACLE_HOME/R/library directory. It also installs and configures the
database components of OML4R. While running the script, you can create a new database
user when prompted to do so. You can create a user while running the script only during the
execution of the server.sh script on the first node.
5-11
Chapter 5
Install Oracle Machine Learning for R for Oracle RAC Without DCLI
When you execute the server.sh script on each subsequent node, the script only
installs the OML4R packages on the operation system.
5-12
6
Install Oracle Machine Learning for R Client
This chapter explains how to install OML4R Client. This chapter includes these topics:
Note:
The version of OML4R must be the same on the server and on each client
computer. Also, the version of R must be the same on the server and on each client
computer.
See Also:
6-1
Chapter 6
About OML4R Client
• Oracle Database Client is distributed with Oracle Database and is based in the
Oracle home of the database.
• Oracle Database Instant Client is a free, standalone implementation of Oracle
Database Client. Oracle Instant Client is not based in an Oracle home directory
and requires less disk space than Oracle Database Client.
Note:
The version of the OML4R packages on the client must match the version of
the OML4R packages on the server.
6-2
Chapter 6
Install Oracle Database Instant Client
6-3
Chapter 6
Install Oracle Database Instant Client
9. Accept the license agreement and select Instant Client Package - SDK for your
version of Oracle Database.
10. Save the file in the installation directory that you created in Step 1.
c:\oml4rclient_install_dir\instantclient-sdk-windows.x64-12.1.0.2.0.zip
11. Unzip the file. The files are extracted into the instantclient_version
subdirectory.
12. 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:\myoml4rclient\instantclient_12_1:
a. In Windows Control Panel, choose System, then click Advanced system
settings.
b. On the Advanced tab, click Environment Variables.
c. Under System variables, create OCI_LIB64 if it does not already exist. Set the
value of OCI_LIB64 to c:\oml4rclient\instantclient_12_1.
d. Under System variables, edit PATH to include
c:\oml4rclient\instantclient_12_1.
See Also:
Create and Modify Environment Variables on Windows
6-4
Chapter 6
Install Oracle Database Instant Client
6. Unzip the file. The files are extracted into a subdirectory called instantclient_version,
where version is your version of Oracle Database. For example:
unzip instantclient-basic-linux.x64-12.1.0.2.0.zip
ls
instantclient_12_1/
instantclient-basic-linux.x64-12.1.0.2.0.zip
7. Return to the Oracle Database Instant Client page for your platform.
8. Select the Instant Client for your platform.
9. On the Instant Client Downloads page for your platform, accept the license agreement
and select Instant Client Package - SDK for your version of Oracle Database.
10. Save the file in the installation directory that you created in Step 1. For example:
\oml4rclient_install_dir\instantclient-sdk-linux.x64-12.1.0.2.0.zip
11. Unzip the file. The contents are extracted into the instantclient_version subdirectory.
unzip instantclient-sdk-linux.x64-12.1.0.2.0.zip
ls
/instantclient_12_1
instantclient-basic-linux.x64-12.1.0.2.0.zip
instantclient-sdk-linux.x64-12.1.0.2.0.zip
cd instantclinet_12_1
ls
/help
/sdk
/vc10
/vc11
6-5
Chapter 6
Install the Oracle Machine Learning for R Packages
10. After installing Oracle Instant Client, add the path of the Oracle Instant Client
libraries to LD_LIBRARY_PATH. For example:
export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib:$LD_LIBRARY_PATH
NOTE: Choose the same installation directory for all OML4R client components.
3. Unzip the file. The contents are extracted into the client subdirectory:
The resulting installation directory, shown in the example at the end of this section,
contains Oracle Instant Client and the OML4R packages.
4. Choose one of the following methods to install the OML4R packages on Windows:
• Install from the R Console
a. Start R x64 from the Windows Start menu.
b. Execute this R command for each zip file in the client directory:
install.packages("oml4rclient_install_dir/client/
client_package_name.zip', repos=NULL)
6-6
Chapter 6
Install the Oracle Machine Learning for R Packages
6-7
Chapter 6
Install the OML4R Supporting Packages
/oml4rclient_install_dir/ore-client-platform-arch-version.zip
NOTE: Choose the same installation directory for all OML4R client components.
3. Unzip the file:
% unzip ore-client-platform-arch-version.zip
When you unzip the file, the /client directory is created and these files are
extracted.
/client/ORE_version_R_arch-unknown-platform-gnu.tar.gz
/client/OREbase_version_R_arch-unknown-platform-gnu.tar.gz
/client/OREcommon_version_R_arch-unknown-platform-gnu.tar.gz
/client/OREdm_version_R_arch-unknown-platform-gnu.tar.gz
/client/OREdplyr_version_R_arch-unknown-platform-gnu.tar.gz
/client/OREeda_version_R_arch-unknown-platform-gnu.tar.gz
/client/OREembed_version_R_arch-unknown-platform-gnu.tar.gz
/client/OREgraphics_version_R_arch-unknown-platform-gnu.tar.gz
/client/OREmodels_version_R_arch-unknown-platform-gnu.tar.gz
/client/OREpredict_version_R_arch-unknown-platform-gnu.tar.gz
/client/OREstats_version_R_arch-unknown-platform-gnu.tar.gz
/client/ORExml_version_R_arch-unknown-platform-gnu.tar.gz
4. Change to /oml4rclient_install_dir/client.
5. Execute the following commands:
6-8
Chapter 6
Install the OML4R Supporting Packages
2. Select the Supporting packages for your platform and accept the license agreement.
Download the zip file to the installation directory that you created for Oracle Instant
Client. For example:
c:\oml4rclient_install_dir\ore-supporting-win-x86_64-1.5.1.zip
NOTE: Choose the same installation directory for all OML4R client components.
3. Unzip the file. The contents are extracted into the supporting subdirectory:
The resulting installation directory, shown in the example at the end of this section,
contains all the client components: Oracle Instant Client, OML4R packages, and OML4R
supporting packages.
4. Choose one of the following methods to install the supporting packages on Windows:
• Install from the R Console
a. Start R x64 from the Windows Start menu.
b. Execute this R command for each zip file in the client directory:
install.packages("oml4rclient_install_dir/support/
support_package_name.zip', repos=NULL)
6-9
Chapter 6
Install the OML4R Supporting Packages
instantclient-basic-linux.x64-version.zip
instantclient-sdk-linux.x64-version.zip
ore-client-win-x86_64-version.zip
ore-supporting-win-x86_64-version.zip
Note:
If you are using Linux 8, then download the Supporting package file for
Linux 8 64-bit.
Note:
Choose the same installation directory for all OML4R client components.
/supporting/arules_1.5-0_R_arch-unknown-platform.tar.gz
/supporting/Cairo_1.5-9_R_arch-unknown-platform.tar.gz
/supporting/DBI_0.6-1_R_arch-unknown-platform.tar.gz
/supporting/png_0.1-7_R_arch-unknown-platform.tar.gz
/supporting/randomForest_4.6-12_R_arch-unknown-platform.tar.gz
6-10
Chapter 6
Install the OML4R Supporting Packages
/supporting/ROracle_1.3-1_R_arch-unknown-platform.tar.gz
/supporting/statmod_1.4.29_R_arch-unknown-platform.tar.gz
4. Change to /oml4rclient_install_dir/supporting
5. Execute the following commands to install the supporting packages on the client:
6. Execute the following commands to install the supporting packages on the database
server. When you install on the server, use the ORE command (instead of the R command
used for the client, as shown in the previous step). This installs the packages
to $ORACLE_HOME/R/library instead of the default location, which is /usr/
lib64/R/library on Linux.
If the RPMs are installed, then the name of the RPM is returned.
6-11
Chapter 6
Connect OML4R Client to OML4R Server
2. If that output is not returned, the RPMs are not installed. To install them, execute
the following commands as root:
• For a remote database, specify the Oracle Database service identifier (SID), the
host name, and the port for the connection.
ore.connect(user="OML_USER", sid="orcl", host="severname",
password="OML_USERpsw",
port=1521, all=TRUE)
Note:
To avoid specifying the password and other connection details in
embedded R scripts, you can use Oracle Wallet. See Create an Oracle
Wallet for an Oracle Machine Learning for R Connection.
See Also:
Oracle Machine Learning for R User’s Guide for details about connecting to
an OML4R server
6-12
7
Administrative Tasks for Oracle Machine
Learning for R
This chapter describes administrative tasks for maintaining and optimizing OML4R.
This chapter contains these topics:
The procedure in the following example installs the Oracle R Distribution 3.3.0 RPMs to a
non-default location and still allows the user to invoke the previously installed version,
R-3.2.0.
The example installs the RPMs into the directory /opt/R330. It installs the following RPMs:
R-3.3.0-2.el6.x86_64.rpm
R-core-3.3.0-2.el6.x86_64.rpm
R-core-extra-3.3.0-2.el6.x86_64.rpm
R-devel-3.3.0-2.el6.x86_64.rpm
libRmath-3.3.0-2.el6.x86_64.rpm
libRmath-devel-3.3.0-2.el6.x86_64.rpm
libRmath-static-3.3.0-2.el6.x86_64.rpm
1. From the directory that contains the RPMs, install the Oracle R Distribution 3.3.0 RPMs
to a non-default location using the --prefix flag:
# rpm -i *.rpm --prefix=/opt/R330
2. Set R_HOME to the R-3.3.0 location and add $R_HOME/bin to PATH:
# export R_HOME=/opt/R330/lib64/R
# export PATH=$R_HOME/bin:$PATH
3. Invoke the newly installed R-3.3.0. If you receive the following error, then add $R_HOME/
port/Linux-X64/lib to LD_LIBRARY_PATH so R recognizes the correct versions of the
pcre, zlib, xz, and bzip libraries:
# R
/opt/R330/lib64/R/bin/exec/R: error while loading shared libraries:
libpcre.so.1: cannot open shared object file: No such file or directory
# export LD_LIBRARY_PATH=$R_HOME/port/Linux-X64/lib:$LD_LIBRARY_PATH
7-1
Chapter 7
Upgrade Oracle Machine Learning for R
# R
If you still want to use the previous version of R, rename the default R
executable /usr/bin/R to the old R version; for example, /usr/bin/R-3.2.0:
# mv /usr/bin/R /usr/bin/R-3.2.0
# R-3.2.0
Oracle Distribution of R version 3.2.0 (--) -- "Full of Ingredients"
Copyright (C) The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)...
Note:
Upgrading from OML4R 1.1 is not supported on IBM AIX. To upgrade Oracle
R Enterprise 1.1 on IBM AIX, first uninstall Oracle R Enterprise 1.1 (including
R) and then download and install the later version.
7-2
Chapter 7
Migrate Oracle Machine Learning for R Data
3. To upgrade OML4R Client, re-install the OML4R packages and supporting packages. You
do not need to uninstall the current packages before installing the new packages.
See Install Oracle Machine Learning for R Client for instructions.
• exp — contains the script ore_srcexport.pl for exporting the RQSYS schema and all
OML4R user data to a dump file.
• imp — contains the script ore_destimport.pl for importing the RQSYS schema and all
OML4R user data from the dump file created by ore_screxport.pl.
• oreuser — contains scripts for exporting and importing data for a specific OML4R user.
Instructions for running the migration scripts are provided in the README.
If you do not migrate the OML4R Server components to the new ORACLE_HOME, then running
an R function using OML4R embedded R execution results in errors such as:
The following steps illustrate migrating OML4R 1.5.1 from an initial database installation on a
Linux system to a new database after a database upgrade. Oracle Database was upgraded
7-3
Chapter 7
Uninstall Oracle Machine Learning for R
from Release 12.1.0.2 to Release 12.2.0.1. Oracle R Distribution and OML4R are not
upgraded, only migrated to the new ORACLE_HOME.
WARNING:
When migrating to an Oracle Database Release 18c or later database
instance, use the rqcfg.sql script. Do not use the server.sh or server.bat
script.
1. Before migrating the OML4R components, back up the RQSYS schema and
OML4R user schema.
2. Run the OML4R Server installation script against the new ORACLE_HOME.
$ ./server.sh
3. As the sysdba user, verify that the OML4R configuration script is pointing to the
new ORACLE_HOME:
SQL> SELECT * FROM sys.rq_config;
NAME VALUE
——————----- ————————————————————————---------------------------
R_HOME /usr/lib64/R
R_LIBS_USER /u01/app/oracle/product/12.2.0.1/dbhome_1/R/library
VERSION 1.5.1
...
4. As the sysdba user, verify that the OML4R dependent libraries ore.so and
librqe.so are in the new ORACLE_HOME:
SQL> SELECT library_name, file_spec FROM all_libraries WHERE owner =
'RQSYS';
LIBRARY_NAME
FILE_SPEC
------------
-------------------------------------------------------
RQ$LIB /u01/app/oracle/product/12.2.0.1/dbhome_1/lib/ore.so
RQELIB /u01/app/oracle/product/12.2.0.1/dbhome_1/lib/
librqe.so
7-4
Chapter 7
Uninstall Oracle Machine Learning for R
Related Topics
• Uninstall Oracle R Distribution
Instructions for uninstalling Oracle R Distribution.
$ cd $ORACLE_HOME/R/server
3. In SQL, run the uninstall script. The script takes a single input, which is the $ORACLE_HOME
location. In the following example, the value of the ORACLE_HOME environment variable
is /u01/app/oracle/product/18.0.0/dbhome_1.
SQL> @rquncfg.sql
Session altered.
Enter value for 1: /u01/app/oracle/product/18.0.0/dbhome_1
You can perform either a full or a partial uninstall. A partial uninstall is performed by default.
WARNING:
Do not use the server.sh script to uninstall Oracle Machine Learning for R
components from Oracle Database Release 18c or Release 19c. Doing so results in
important files being deleted from the database. Instead, for an 18c or later
database, use the rquncfg.sql script.
7-5
Chapter 7
Uninstall Oracle Machine Learning for R
Note:
If you accidentally perform a full uninstall for one of the instances or PDBs
that share support for OML4R Server, then the other shared instances or
PDBs will no longer support OML4R Server. You can easily restore OML4R
Server support in Oracle home by rerunning the server script to perform an
installation in one of the shared instances or PDBs.
If you run the server script with the -u option, then a partial uninstall is performed. You
can specify the --keep option to explicitly request a partial uninstall. The following
commands all perform a partial uninstall of OML4R Server:
./server.sh --uninstall
./server.sh -u
./server.sh -u --keep
./server.sh --uninstall --keep
Related Topics
• Uninstall OML4R Server from Oracle Database 18c or Later
How to uninstall OML4R from Oracle Database Release 18c or later.
Note:
If you accidentally perform a full uninstall in a shared Oracle home, then
rerun the server script to reinstall OML4R Server support. See Performing a
Partial Uninstall for details.
7-6
Chapter 7
Install Additional R Packages on Linux or UNIX
Related Topics
• Uninstall OML4R Server from Oracle Database 18c or Later
How to uninstall OML4R from Oracle Database Release 18c or later.
7-7
Chapter 7
Create a Database User for Oracle Machine Learning for R
If you choose a user that exists, the script configures the user to support OML4R. If
you specify a user that does not already exist, the script creates the user.
Example 7-3 Creating an OML4R User in SQL*Plus
You can create an OML4R user in SQL*Plus by following these steps:
1. Log in with system privileges:
SQLPLUS / AS SYSDBA
2. Execute a statement like the following to create the user:
CREATE USER oml_username IDENTIFIED BY password
DEFAULT TABLESPACE default_tablepace_name
TEMPORARY TABLESPACE temp_tablespace_name
QUOTA UNLIMITED ON default_tablespace_name;
See Also:
Oracle Database SQL Language Reference for details about creating a
user
See Also:
Oracle Database SQL Language Reference for details about granting
privileges to a user
7-8
Chapter 7
Create and Modify Environment Variables on Windows
When the RQADMIN role is granted to an OML4R user, the user can create and drop R
scripts for embedded R execution. By default, the server script does not grant the RQADMIN
role to the OML4R user.
Note:
Any OML4R user can execute embedded R, but only OML4R users with the
RQADMIN role can create and drop the R scripts.
If you choose to grant the RQADMIN role in SQL*Plus, then log in with system privileges and
execute a statement like the following:
SQLPLUS / AS SYSDBA
GRANT RQADMIN TO oml_username;
Caution:
Use caution when granting the RQADMIN role. Only users that require OML4R
administrative privileges should have this role.
Related Topics
• Security Best Practices for OML4R
To minimize the risk of compromising the security of an OML4R Server in Oracle
Database, Oracle recommends the following security best practices.
7-9
Chapter 7
Create and Modify Environment Variables on Windows
7-10
Chapter 7
Create and Modify Environment Variables on Windows
4. Click New to create a new environment variable. Click Edit to modify an existing
environment variable.
5. After creating or modifying the environment variable, click Apply and then OK to
have the change take effect.
Note:
The graphical user interface for creating environment variables may vary slightly,
depending on your version of Windows.
7-11
Chapter 7
Create an Oracle Wallet for an Oracle Machine Learning for R Connection
7-12
Chapter 7
Create an Oracle Wallet for an Oracle Machine Learning for R Connection
When prompted to do so, assign a username and password. This example uses the
database user OML_USER with the password apassword and the PDB ORCL.
2. Assign wallet credentials.
$ sqlplus /@ORCL
ore.doEval(function(){print("TEST")})
TEST_WALLET_DF
function() {
return(as.data.frame(length(iris)))
}
ore.scriptLoad("TEST_WALLET_DF")
ore.doEval(FUN.NAME="TEST_WALLET_DF")
length(iris)
> ore.doEval(function(){print("TEST")})
[1] "TEST"
>
> TEST_WALLET_DF
function() {
return(as.data.frame(length(iris)))
}
>
> ore.scriptLoad("TEST_WALLET_DF")
>
7-13
Chapter 7
Control Memory Used by Embedded R
> ore.doEval(FUN.NAME="TEST_WALLET_DF")
> length(iris)
1 5
Note:
In embedded R execution, an R function that creates a database connection
will fail because Oracle Database does not support recursive external
procedures. To connect an embedded R execution function to a database,
use the ore.connect special control argument.
-- Set maximum vector heap memory and maximum cons cells to unlimited
EXEC sys.rqconfigset('MAX_VSIZE', NULL);
EXEC sys.rqconfigset('MAX_NSIZE', NULL);
7-14
Chapter 7
Control Memory Used by Embedded R
Note:
The sys.rqconfigset procedure does not control the C type memory that may be
allocated by Calloc, Realloc, calloc, or malloc. Such C type memory is mainly
created to hold temporary values used by R functions that are implemented in C.
Under normal circumstances, C type memory is limited in size and does not
significantly affect the memory usage of R.
NAME VALUE
------------------------- -----------------------------------------------------
R_HOME /usr/lib64/R
R_LIBS_USER /dbhome_1/R/library
VERSION 1.5.1
MIN_VSIZE 32M
MAX_VSIZE 4G
MIN_NSIZE 2M
MAX_NSIZE 20M
7-15
A
A Sample Installation of Oracle Machine
Learning for R
Steps in a typical installation of OML4R Server on a Linux server running Oracle Database
12c, Release 12.1.0.2, and OML4R Client on a Windows system.
Note:
This appendix describes an initial installation of OML4R. If OML4R components
already exist on your client or server, refer to Upgrade Oracle Machine Learning for
R.
A-1
Appendix A
Install Oracle Machine Learning for R on the Server
Table A-1 Checklist for Oracle Machine Learning for R Server Requirements
A-2
Appendix A
Install Oracle Machine Learning for R on the Server
Table A-1 (Cont.) Checklist for Oracle Machine Learning for R Server Requirements
[el6_addons]
enabled=1
4. Install Oracle R Distribution 3.3 by executing these commands:
5. Set LD_LIBRARY_PATH to the location of the files installed by the R-core-extra RPM:
6. Exit the root user.
exit
A-3
Appendix A
Install Oracle Machine Learning for R on the Server
The installation directory looks like this after you unzip both files:
/myhome/myomlserver
ore-server-linux-x86-64-1.5.1.zip
ore-supporting-linux-x86-64-1.5.1.zip
server.sh
/server
/supporting
5. Run server.sh to perform a default installation of OML4R Server as shown in the
following example. In this 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.
6. On Oracle Linux 6, set LD_LIBRARY_PATH to the location of the files installed by the
R-core-extra RPM:
export LD_LIBRARY_PATH=/usr/lib64/R/port/Linux-X64/lib
A-4
Appendix A
Install Oracle Machine Learning for R on the Server
Copyright (c) 2012, 2017 Oracle and/or its affiliates. All rights reserved.
Current configuration
R Version ...................... Oracle Distribution of R version 3.3.0 (--)
R_HOME ......................... /usr/lib64/R
R_LIBS_USER .................... /product/12.1.0.2/dbhome_1/R/library
ORACLE_HOME .................... /product/12.1.0.2/dbhome_1
ORACLE_SID ..................... orcl
A-5
Appendix A
Install Oracle Machine Learning for R on the Client
Proceed? [yes] y
Done
See Also:
A-6
Appendix A
Install Oracle Machine Learning for R on the Client
A-7
Appendix A
Install Oracle Machine Learning for R on the Client
When you unzip the file, the sdk subdirectory is created. The contents of the
installation directory are shown as follows:
myoml4rclient
instantclient_12_1
help
sdk
vc10
vc11
vc12
11. 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:\myoml4rclient\instantclient_12_1:
a. In Windows Control Panel, choose System.
b. Click Advanced systems settings.
c. On the Advanced tab, click Environment Variables.
d. Under System variables, create OCI_LIB64 if it does not already exist. Set the
value of OCI_LIB64 to c:\oml4rclient\instantclient_12_1.
e. Under System variables, edit PATH to include
c:\myoml4rclient\instantclient_12_1.
Note:
The graphical user interface for creating environment variables may
vary slightly, depending on your version of Windows.
To be able to load the ROracle package, you must first add the full
path of the Oracle Instant Client to the PATH and the OCI_LIB64
environment variables. For troubleshooting tips, refer to the
Troubleshooting section in the ROracle INSTALL file on CRAN at
ROracle INSTALL.
A-8
Appendix A
Install Oracle Machine Learning for R on the Client
ORE_1.5.1.zip
OREbase_1.5.1.zip
OREcommon_1.5.1.zip
OREdm_1.5.1.zip
OREdplyr_1.5.1.zip
OREeda_1.5.1.zip
OREembed_1.5.1.zip
OREgraphics_1.5.1.zip
OREmodels_1.5.1.zip
OREpredict_1.5.1.zip
OREstats_1.5.1.zip
ORExml_1.5.1.zip
A-9
Appendix A
Verifying the Oracle Machine Learning for R Installation
ROracle_1.3-1.zip
statmod_1.4.21.zip
Note:
To start and use OML4R, your database user must have the privileges
required for OML4R installation. See User Requirements for details.
A-10
Appendix A
Verifying the Oracle Machine Learning for R Installation
df <- data.frame(a="abc",
b=1.456,
c=TRUE,
d=as.integer(1))
of <- ore.push(df)
A-11
B
R Package Installation Tips
This appendix introduces some of the mechanics involved in working with R packages. If you
are tasked with installing, uninstalling, or upgrading Oracle Machine Learning for R but you
do not have extensive experience working with R packages, then you may find the
information in this appendix helpful.
This appendix contains these topics:
Within R, using the install.packages function always attempts to install the latest version of
the requested package available on CRAN:
R> install.packages("arules")
If the arules package depends upon other packages that are not already installed locally, the
R installer automatically downloads and installs those required packages. This is a huge
benefit that frees users from the task of identifying and resolving those dependencies.
You can also install R from the shell command line. This is useful for some packages when
an internet connection is not available or for installing packages not uploaded to CRAN. To
install packages this way, first locate the package on CRAN and then download the package
source to your local machine. For example:
$ wget https://cran.r-project.org/src/contrib/arules_1.1-9.tar.gz
A major difference between installing R packages using the R package installer at the R
command line and shell command line is that package dependencies must be resolved
manually at the shell command line. Package dependencies are listed in the Depends section
of the package's CRAN site. If dependencies are not identified and installed prior to the
package's installation, you will see an error similar to:
ERROR: dependency 'xxx' is not available for package 'yyy'
As a best practice and to save time, always refer to the package's CRAN site to understand
the package dependencies prior to attempting an installation.
If you don't run R as root, you won't have permission to write packages into the default
system-wide location and you will be prompted to create a personal library accessible by your
userid. You can accept the personal library path chosen by R, or specify the library location
B-1
Appendix B
Set the R Repository
or
$ R CMD INSTALL arules_1.1-9.tar.gz --library=/home/username/Rpackages
Refer to the install.packages help file in R or execute R CMD INSTALL --help at the
shell command line for a full list of command line options.
To set the library location and avoid having to specify this at every package install,
simply create the R startup environment file .Renviron in your home area if it does not
already exist, and add the following piece of code to it:
R_LIBS_USER = "/home/username/Rpackages"
B-2
Appendix B
About CRAN Task Views
To install a package on the database server so that any R user can use it and for use in
embedded R execution, an Oracle DBA would typically download the package source from
CRAN using wget. If the package depends on any packages that are not in the R distribution
in use, download the sources for those packages, also.
For a single Oracle Database instance, replace the R script with ORE to install the packages in
the same location as the OML4R packages.
$ wget https://cran.r-project.org/src/contrib/arules_1.1-9.tar.gz
$ ORE CMD INSTALL arules_1.1-9.tar.gz
Behind the scenes, the ORE script performs the equivalent of setting R_LIBS_USER to the value
of $ORACLE_HOME/R/library, and all R packages installed with the ORE script are installed to
this location. For installing a package on multiple database servers, such as those in an
Oracle Real Application Clusters (Oracle RAC) or a multinode Oracle Exadata Database
Machine environment, use the ORE script in conjunction with the Exadata Distributed
Command Line Interface (DCLI) utility.
$ dcli -g nodes -l oracle ORE CMD INSTALL arules_1.1-9.tar.gz
The DCLI -g flag designates a file containing a list of nodes to install on, and the -l flag
specifies the user id to use when executing the commands.
If you are using an OML4R client, install the package in the same way as any R package,
bearing in mind that you must install the same version of the package on both the client and
server machines to avoid incompatibilities.
R> install.packages("ctv")
R> library(ctv)
Then query the names of the available task views and install the view you choose.
R> available.views()
R> install.views("TimeSeries")
B-3
Appendix B
About CRAN Task Views
R> library(arules)
R> packageVersion("arules")
[1] '1.1.9'
Verify the version of arules installed on the database server using embedded R
execution.
View the help file for the apropos function in the arules package.
R> ?apropos
Over time, your package repository will contain more and more packages, especially if
you are using the system-wide repository in which others are also adding packages.
It's good to know the entire set of R packages accessible in your environment. To list
all available packages in your local R session, use the installed.packages
command:
B-4
C
Installing RStudio
This appendix provides tips for installing RStudio Server for use with Oracle Machine
Learning for R on Linux. This appendix includes these topics:
About RStudio
Describes RStudio.
RStudio is a free, open source Integrated Development Environment (IDE) for R. RStudio is
available under GNU Affero General Public License (AGPL). You can use RStudio with
Oracle Machine Learning for R, however RStudio is not included with OML4R. If you want to
use RStudio, you must install and license it separately.
See Also:
To install RStudio Server for use with Oracle Machine Learning for R:
1. Go to the RStudio website and navigate to the RStudio Server Download page.
Download the server to your Linux system and follow the installation instructions.
2. Create the file /etc/rstudio/rserver.conf. Add the values of R_HOME and ORACLE_HOME.
sudo vi /etc/rstudio/rserver.conf
rsession-ld-library-path=R_HOME/lib:ORACLE_HOME/lib
cd /usr/lib64/R/etc
sudo vi Renviron.site
ORACLE_HOME=ORACLE_HOME
ORACLE_HOSTNAME=ORACLE_HOSTNAME
ORACLE_SID=ORACLE_SID
C-1
Appendix C
Install RStudio Desktop
Refer to the instructions for configuring the server. Return to the RStudio Server
Download page, then navigate to the Configuring the Server article in the RStudio
documentation.
C-2
D
Oracle R Distribution Packages
The table in this section lists the packages in Oracle R Distribution that are used by Oracle
Machine Learning for R.
See Also:
• Table 6-1 for a list of the packages in Oracle Machine Learning for R
• Table 6-2 for a list of the open source packages that ship with Oracle Machine
Learning for R
Table D-1 Oracle R Distribution Packages Used by Oracle Machine Learning for R
D-1
Appendix D
Table D-1 (Cont.) Oracle R Distribution Packages Used by Oracle Machine Learning
for R
D-2
Index
C installation scripts
for 12c and earlier, 4-8
CDB, 4-11 for 18c and later, 4-5
client installing
components, 6-1 client, 6-1
installing, 6-1, A-6 example for Oracle Database 12c and
requirements, A-1 earlier, A-1
client/server architecture, 1-1 Oracle Database Instant Client, 6-3
connecting to the server, 4-15, 6-12 overview, 1-2
server for 12c and earlier, 4-8
server for 18c and later, 4-5
D server on Exadata, 5-1
database user requirements for, 4-4, A-1
configuring extproc, 2-1 installion
connecting to, 6-12 verifying, A-10
installing, 2-1 Instant Client, 6-1, A-7
PDB, 2-1, 4-15, 7-6 installing on Linux or UNIX, 6-4
requirements, 1-5, 2-1 installing on Windows, 6-3
database user
creating, 4-11, 7-7 L
requirements, 4-4
dba group, 4-5, A-1 LD_LIBRARY_PATH, A-1
DCLI, 5-1 Linux
Distributed Command Line Interface, 5-1 requirements, 1-5
E M
embedded R execution, 1-1, A-10 Math Kernel Library, 3-2, 3-12
scripts requiring RQADMIN role, 7-8 Microsoft Windows
environment variables requirements, 1-5
creating on Windows, 7-9 verifying 64-bit architecture, 1-5
requirements, 4-3 migrating
Exadata data, 7-3
installing server on, 5-1 server components, 7-3
extproc, 2-1 multitenant architecture, 2-1, 4-15, 7-6
troubleshooting, 2-3
O
I
Oracle Call Interface, 6-1
IBM AIX, 4-4 Oracle Data Mining rebranded, vii
requirements, 1-5 Oracle Database
upgrade restriction, 7-2 configuring extproc, 2-1
installation installing, 2-1
verifying server, 4-13 requirements, 1-5, 2-1
Oracle Database Client, 1-2, 6-1, A-7
Index-1
Index
Index-2
Index
Index-3