Migrating an On-Premises Database to Oracle Cloud Infrastructure by Creating a Backup in the Cloud

Note

This topic is not applicable to Exadata DB systems.

You can migrate an on-premises database to Oracle Cloud Infrastructure by creating a backup of your on-premises database in Oracle Cloud Infrastructure's Database service. 

Oracle provides a Python script to create a backup of your database. The script invokes an API call to create the backup and then places the backup in Oracle Cloud Infrastructure. You can then use the Console or the API to create a new database or DB system from that backup. Backups created using the instructions in this topic appear under Standalone Backups in the console.

The Python script is bundled as a part of the Oracle Cloud Infrastructure CLI installation. Oracle provides the migration script and associated files at no cost. Normal Object Storage charges apply for the storage of your backup in Oracle Cloud Infrastructure.

Compatibility

The scripted migration process is compatible with the following bare metal and virtual machine DB system configurations:

Configuration Version or Type Notes
Database Version

19.x

18.x

12.2.0.1

12.1.0.2

11.2.0.4

  • For versions 19c, 18c, 12.2.0.1, and 12.1.0.2:
    • Only Container Databases (CDBs) are supported. The scripted migration process may work with non-CDB databases for these database versions, but Oracle does not provide support for the migration of non-CDB databases using the script described in this topic.

      For information on creating an on-premises pluggable database (PDB) by cloning a non-CDB in Oracle Database 19c, see About Cloning a Non-CDB. For an overview of multitenant architecture in Oracle Database 19c, see Introduction to the Multitenant Architecture.

      For information on creating an on-premises pluggable database (PDB) from a non-CDB database in Oracle Database 12c Release 2 (12.2), see Upgrading a Non-CDB Oracle Database To a PDB on a CDB. For an overview of multitenant architecture in 12c Release 2, see Overview of Managing a Multitenant Environment.

    • The Oracle Cloud Infrastructure Database service will attempt to run datapatch, which requires read/write mode. If there are pluggable databases (PDBs), they should also be in read/write mode to ensure that datapatch runs on them.
  • For version 11.2.0.4, depending on the source database patch level, you may need to roll back patches prior to migrating. See Rolling Back Patches on a Version 11.2 Database for more information.
  • If your on-premises database has an interim patch (previous known as a one-off patch), see Applying Interim Patches for details on applying the patch in Oracle Cloud Infrastructure.
Source Database Platform

Oracle Enterprise Linux / Red Hat Enterprise Linux 5.x

Oracle Linux / Red Hat Enterprise Linux 6.x

Oracle Linux / Red Hat Enterprise 7.x

  • The scripted migration described in this topic may work in Microsoft Windows environments, but Oracle currently does not provide support for this script in Windows.
  • For Oracle Linux 6.x users, see Configuring Oracle Linux 6 to install Python for details on configuring the operating system to install a compatible version of Python. See Installing the CLI for more information regarding Oracle Linux 6.
Encryption

TDE

Non-TDE

  • In a non-TDE configuration, the RMAN encryption password is required.
  • Oracle requires that unencrypted on-premises databases be encrypted after they are restored to Oracle Cloud Infrastructure. The stored RMAN standalone backups are always encrypted.
Target Database Edition

Standard Edition

Enterprise Edition

Enterprise Edition - High Performance

Enterprise Edition - Extreme Performance

 
Cluster

Single

RAC

 

Prerequisites

On the source database host:

  • Outbound internet connectivity for installing Python packages, running yum install, and access to the Oracle Cloud Infrastructure API and Object Storage.
  • RMAN configuration to autobackup controlfile and spfile:

    RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
    Note

    RMAN configuration changes must be completed prior to running the script. The script may modify RMAN parameters as required to complete the backup and migration tasks.

To Migrate an On-Premises Database Using a Standalone Backup

Perform the following tasks on the source database host:

  1. Create a directory named /home/oracle/migrate.

    Tip

    You can name the migrate portion of the directory path anything you want. If you use a different name, you must adjust all of the paths that appear in this task accordingly. The following examples assume the name migrate for simplicity and clarity.
  2. As root, run the CLI installer in the directory you created in step 1. (For example, /home/oracle/migrate.) See Installing the CLI for instructions on running the installer script in either Windows or the Bash environment (for MacOS, Linux, and Unix).

    The installer installs Python 3.6.0 if either Python 2.7 or Python 3.6 does not exist on the machine. The installer also installs the Python script required to create and migrate a standalone backup from an on-premises database.

    On Oracle Linux 6, a newer version of Python (such as Python 3.6.0) is usually required. Use the following instructions to configure Oracle Linux 6 before running the backup script.

  3. Copy the following files into the new directory:

  4. Respond to the prompts as follows:

    
    (yum install)
    Is this ok [y/N]: y
    
    ===> Missing native dependencies. Continue and install the following dependencies: gcc, libffi-devel, python36u-devel, openssl-devel? (Y/n): Y
    
    ===> In what directory would you like to place the install? (leave blank to use '/root/lib/oracle-cli'): /home/oracle/migrate/lib/oracle-cli
    
    ===> In what directory would you like to place the 'oci' executable? (leave blank to use '/root/bin'): /home/oracle/migrate/bin
    
    ===> In what directory would you like to place the OCI scripts? (leave blank to use '/root/bin/oci-cli-scripts'): /home/oracle/migrate/bin/oci-cli-scripts
    
    ===> Currently supported optional packages are: ['db (will install cx_Oracle)'] What optional CLI packages would you like to be installed (comma separated names; press enter if you don't need any optional packages)?: db
    
    ===> Modify profile to update your $PATH and enable shell/tab completion now? (Y/n): Y
    
    ===> Enter a path to an rc file to update (leave blank to use '/root/.bashrc'): /home/oracle/.bashrc
  5. Perform the following file operations:

    
    
    # mv /home/oracle/migrate/lib/oracle-cli/lib/python<version>/site-packages/oci_cli/scripts/dbaas.py /home/oracle/migrate/lib/oracle-cli/lib/python<version>/site-packages/oci_cli/scripts/dbaas_orig.py
    # cp /home/oracle/migrate/dbaas_0704.py /home/oracle/migrate/lib/oracle-cli/lib/python<version>/site-packages/oci_cli/scripts/dbaas.py
    
    
    # chown -R oracle:oinstall /home/oracle/migrate
  6. Edit the /home/oracle/migrate/config.txt file

    [DEFAULT]
    tenancy=<your_tenancy_OCID>
    user=<your_user_OCID>
    fingerprint=<fingerprint>
    key_file=/home/oracle/migrate/<your_api_key>.pem
    region=<region>

    If you do not know your API signing key's fingerprint, see How to Get the Key's Fingerprint.

  7. As oracle user (not root), run one of the following sets of commands, depending on the type of database you are migrating.

    For a non-TDE database:

    export AD=<destination_availability_domain>
    export C=<destination_compartment_OCID>
    export ORACLE_SID=<ORACLE_SID>
    export ORACLE_HOME=<ORACLE_HOME>
    export PATH=$PATH:$ORACLE_HOME/bin
    export LC_ALL=en_US.UTF-8
    export ORACLE_UNQNAME=<source_DB_unique_name>
    rm -rf /home/oracle/migrate/onprem_upload
    cd /home/oracle/migrate/bin/oci-cli-scripts/
    ./create_backup_from_onprem --config-file /home/oracle/migrate/config.txt --display-name <example_display_name> --availability-domain $AD --edition ENTERPRISE_EDITION_EXTREME_PERFORMANCE --opc-installer-dir /home/oracle/migrate --tmp-dir /home/oracle/migrate/onprem_upload --compartment-id $C --rman-password <password>

    For a TDE-enabled database:

    export AD=<destination_availability_domain>
    export C=<destination_compartment_OCID>
    export ORACLE_SID=<ORACLE_SID>
    export ORACLE_HOME=<ORACLE_HOME>
    export PATH=$PATH:$ORACLE_HOME/bin
    rm -rf /home/oracle/migrate/onprem_upload
    cd /home/oracle/migrate/bin/oci-cli-scripts/
    ./create_backup_from_onprem --config-file /home/oracle/migrate/config.txt --display-name <example_display_name> --availability-domain $AD --edition ENTERPRISE_EDITION_EXTREME_PERFORMANCE --opc-installer-dir /home/oracle/migrate --tmp-dir /home/oracle/migrate/onprem_upload --compartment-id $C

    See the following list of parameters used by the script for more details.

  8. Create a new database or launch a new DB system using the backup you created in the preceding step. See Creating Databases for information on creating a new database from a backup. See Creating Bare Metal and Virtual Machine DB Systems for information on creating a new DB system from a backup.

Configuring Oracle Linux 6 to install Python

In Oracle Linux 6 use the following /etc/yum.repos.d/ol6.repo file to ensure that a compatible version of Python is installed by the script if a compatible version is not already installed. Include this file before attempting to run the script with the ./install.sh command.


[ol6_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL6/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1						
Parameters used by the script
Parameter Description Required
--config-file

The path to the oci-cli config file. The default path is as follows: ~/.oci/config

No
--profile The profile in the config file to load. This profile will also be used to locate any default parameter values which have been specified in the OCI CLI-specific configuration file. The default value is DEFAULT. No
--compartment-id The compartment OCID of the Oracle Cloud Infrastructure compartment  that will contain your standalone backup. Yes
--display-name

The name of the backup, as you want it to be displayed in the OCI Console under Standalone Backups. Avoid entering confidential information.

Yes

--availability-domain

The availability domain where the backup is to be stored.

Yes
--edition

The edition of the Oracle Cloud Infrastructure DB system that will contain the database created from the standalone backup. You can choose the same edition as the on-premises database, or any addition above the on-premises database. The choices, listed from lowest to highest, are the following:

  • STANDARD_EDITION
  • ENTERPRISE_EDITION
  • ENTERPRISE_EDITION_HIGH_PERFORMANCE
  • ENTERPRISE_EDITION_EXTREME_PERFORMANCE
Yes
--opc-installer-dir

The directory containing the opc_installer.jar file. This is the directory you created in step 1 of this procedure.

Yes
--additional-opc-args Optional additional arguments for the opc installer. No
--tmp-dir Optional temporary directory for intermediate files. No
--rman-password The RMAN password to use for the standalone backup. The password must have 8 or more characters. Required if TDE is not enabled
--rman-channels RMAN channels. The default value is 5. No
--help Displays in-line help for the script in the OCI-CLI environment. No

The script will produce a standalone backup of your on-premises database in your Oracle Cloud Infrastructure tenancy. You can check the Console for your backup by viewing the Standalone Backups page in the Database service, under Bare Metal, VM, and Exadata.

Tip

To access command line help for the backup script, run the following command in the /home/oracle/migrate/bin/oci-cli-scripts/ directory: create_backup_from_onprem --help