This chapter describes administrative tasks for maintaining and optimizing Oracle R Enterprise. This chapter contains these topics:
To upgrade Oracle R Enterprise and migrate your data:
Ensure that you have the version of R that is required for the new version of Oracle R Enterprise.
See Table 1-2 for the R requirement.
When the script detects an earlier version of Oracle R Enterprise Server, it asks if you want to upgrade. Type
Yes to start the upgrade. (Type
No to aborts the process.)
See About the SERVER Script for details.
To upgrade Oracle R Enterprise Client, re-install the Oracle R Enterprise packages and supporting packages. You do not need to uninstall the current packages before installing the new packages.
See Installing Oracle R Enterprise Client for instructions.
Oracle R Enterprise Server includes migration scripts that you can run to migrate the
rqsys schema and Oracle R Enterprise user data from a source database to a target database. The source and target must have the same version of the database and of Oracle R Enterprise Server.
To locate the scripts, navigate to the
server directory and change to the
migration subdirectory contains a README and the following subdirectories:
exp — contains the script
ore_srcexport.pl for exporting
rqsys and all Oracle R Enterprise user data to a dump file.
imp — contains the script
ore_destimport.pl for importing
rqsys and all Oracle R Enterprise user data from the dump file created by
oreuser — contains scripts for exporting and importing data for a specific Oracle R Enterprise user.
Instructions for running the migration scripts are provided in the README.
This topic contains these sections:
A partial uninstall removes the
rqsys metadata and PL/SQL packages from the database but leaves the libraries and R packages that support Oracle R Enterprise Server in Oracle home. If Oracle R Enterprise Server support is installed in more than one database instance in the same Oracle home, or if it is installed in a pluggable database (PDB), then a partial uninstall removes Oracle R Enterprise Server support from the specified database without affecting the other databases. The
server script performs a partial uninstall by default.
If you accidentally perform a full uninstall for one of the instances or PDBs that share support for Oracle R Enterprise Server, then the other shared instances or PDBs will no longer support Oracle R Enterprise Server. You can easily restore Oracle R Enterprise 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 Oracle R Enterprise Server:
./server.sh --uninstall ./server.sh -u ./server.sh -u --keep ./server.sh --uninstall --keep
The following commands both perform a full uninstall of Oracle R Enterprise Server:
./server.sh --uninstall --full ./server.sh -u -full
If you accidentally perform a full uninstall in a shared Oracle home, then rerun the
server script to reinstall Oracle R Enterprise Server support. See Performing a Partial Uninstall for details.
To uninstall the Oracle R Enterprise packages and supporting packages, start R and type the commands listed in Example 7-1.
Example 7-1 R Commands for Uninstalling Oracle R Enterprise Packages
remove.packages("ORE") remove.packages("ORExml") remove.packages("OREeda") remove.packages("OREcommon") remove.packages("OREembed") remove.packages("OREgraphics") remove.packages("OREstats") remove.packages("OREbase") remove.packages("ROracle") remove.packages("DBI") remove.packages("Cairo") remove.packages("png") remove.packages("OREdm") remove.packages("OREpredict") remove.packages("arules") remove.packages("statmod") remove.packages("randomForest")
On Linux and UNIX platforms, the Oracle R Enterprise Server installation provides the
ORE script, which you can run from the operating system prompt to install additional R packages. The
ORE script is a wrapper for the R installation command:
R CMD INSTALL.
By default, R packages are installed in /
ORE script, however, installs R packages in a subdirectory under
To execute the script:
ORE CMD INSTALL R_package_name
Example 7-2 Creating an Oracle R Enterprise User
./server.sh . . Choosing ORE user ORE user to use [list]:
Press Enter to display a list of available users.
BI HR IX OE SCOTT SH ORE user to use [list]: ruser2 . .
If you choose a user that exists, the script configures the user to support Oracle R Enterprise. If you specify a user that does not already exist, the script creates the user.
Example 7-3 Creating an Oracle R Enterprise User in SQL*Plus
You can create an Oracle R Enterprise user in SQL*Plus by following these steps:
Log in with system privileges:
SQLPLUS / AS SYSDBA
Execute a statement like the following to create the user:
CREATE USER ore_username IDENTIFIED BY password DEFAULT TABLESPACE default_tablepace_name TEMPORARY TABLESPACE temp_tablespace_name QUOTA UNLIMITED ON default_tablespace_name;
Oracle Database SQL Language Reference for details about creating a user
Grant the required privileges:
GRANT CREATE SESSION, CREATE TABLE, CREATE VIEW, CREATE PROCEDURE, CREATE MINING MODEL TO ore_username;
Oracle Database SQL Language Reference for details about granting privileges to a user
server script installation process creates a database role called
rqadmin. When the
rqadmin role is granted to an Oracle R Enterprise 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 Oracle R Enterprise user.
Any Oracle R Enterprise user can execute embedded R, but only Oracle R Enterprise users with the
rqadmin role can create and drop the R scripts.
As shown in User Configuration in Batch Mode, you can run the
server script with the
--admin option to grant the
rqadmin role to an Oracle R Enterprise user. The
--admin option is only available when you run the script in batch mode.
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 ore_username;
Use caution when granting the
rqadmin role. Only users that require Oracle R Enterprise administrative privileges should have this role.
ORACLE_HOME environment variables do not exist, you must create them and assign the values specified in Figure 7-2. On Windows systems, you must be an administrator to create or modify environment variables.
Follow these steps to create or modify environment variables on Windows:
Right-click the Computer icon and choose Properties, or in Windows Control Panel, choose System.
Choose Advanced system settings.
Figure 7-1 Advanced System Settings in Windows
On the Advanced tab, click Environment Variables.
Figure 7-2 Environment Variables Dialog in Windows
Click New to create a new environment variable. Click Edit to modify an existing environment variable.
The graphical user interface for creating environment variables may vary slightly, depending on your version of Windows.
An Oracle wallet is a password-protected container for storing security credentials in Oracle Database. Wallets provide a secure mechanism for specifying connection details in embedded R scripts.
To create a wallet for an Oracle R Enterprise connection:
Start Oracle Wallet Manager:
(Linux and UNIX) At the command line, enter
(Windows) Select Start, Programs, Oracle-HOME_NAME, Integrated Management Tools, Wallet Manager.
Follow the instructions in your Oracle Database documentation to create the wallet:
For Oracle Database 12.1, see "Using Oracle Wallet Manager" in Oracle Database Enterprise User Security Administrator's Guide:
For Oracle Database 11.2, see "Using Oracle Wallet Manager" in Oracle Database Advanced Security Administrator's Guide:
Locate the connection string for the Oracle R Enterprise database in
tnsnames.ora. For example:
mydb_test = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = server23) (PORT = 1521) ) (CONNECT_DATA = (sid=ORCL)) )
Specify the connection information in the wallet. Follow the instructions in the Oracle Database security documentation referenced in Step 2.
After you configure the wallet, you can connect to the Oracle R Enterprise server database by simply specifying the connection identifier. For example:
ore.connect(conn_string = "mydb_test", all = TRUE)
To learn more about
ore.connect, use the R help command:
You can control the memory used by embedded R execution by limiting the heap memory (vector and cons in R terminology) that is automatically managed by the R
gc mechanism. To limit the size of heap memory in the database, use the
sys.rqconfigset utility. The keyword arguments for
sys.rqconfigset are described in the following table.
Table 7-1 SYS.RQCONFIGSET Keyword Arguments
Minimum R vector heap memory
Maximum R vector heap memory
Minimum number of R cons cells
Maximum number of R cons cells
Example 7-4 SQL Commands for Controlling Memory Used by Embedded R
-- Set the minimum R vector heap memory to 20M EXEC sys.rqconfigset('MIN_VSIZE', '20M'); -- Set the maximum R vector heap memory to 100M EXEC sys.rqconfigset('MAX_VSIZE', '100M') -- Set the minimum number of R cons cells to 500x1024 EXEC sys.rqconfigset('MIN_NSIZE', '500K'); -- Set the maximum number of R cons cells to 10x10x1024 EXEC sys.rqconfigset('MAX_NSIZE', '10M'); -- Set maximum vector heap memory and maximum cons cells to unlimited EXEC sys.rqconfigset('MAX_VSIZE', NULL); EXEC sys.rqconfigset('MAX_NSIZE', NULL);
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.
sys.rqconfigset procedure edits settings in a configuration table called
sys.rq_config. You can view the contents of this table to verify various environment settings for Oracle R Enterprise. Among the settings stored in
sys.rq_config are the memory limits for embedded R. If necessary, you can modify these memory limits, however in most cases you should not modify the values in
The following query shows sample values stored in
SQL> SELECT * FROM sys.rq_config; NAME VALUE ------------------------- ----------------------------------------------------- R_HOME /usr/lib64/R R_LIBS_USER /dbhome_1/R/library VERSION 1.5 MIN_VSIZE 32M MAX_VSIZE 4G MIN_NSIZE 2M MAX_NSIZE 20M