7.4 Migrate Oracle Machine Learning for R After a Database Upgrade

After upgrading your Oracle Database, you must migrate your OML4R Server components to the new ORACLE_HOME.

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:
ORA-28578: protocol error during callback from an external procedure

The components of OML4R Server are:

  • The Oracle Database schema RQSYS and schema-related objects

  • Oracle Database shared libraries for supporting OML4R clients

  • OML4R packages and supporting packages installed on the Oracle Database server

After a database upgrade, you must migrate the RQSYS schema and dependent database components to the new ORACLE_HOME. The OML4R packages must also be installed to the new database location.

You can easily do this by running the OML4R Server installation script against the new ORACLE_HOME. Doing so creates a new path to the ORACLE_HOME in the OML4R metadata.

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 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
  5. Finally, test the OML4R installation against the upgraded ORACLE_HOME by connecting your OML4R client to the OML4R server and running OML4R examples, such as those in the Correlating Data and Using the ore.tableApply Function topics in Oracle Machine Learning for R User’s Guide. These examples use the iris data set in the datasets package that is included in an R distribution.