Migrating an On-Premises Database to Oracle Cloud Infrastructure by Creating a Backup in the Cloud
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 |
|
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 |
|
Encryption |
TDE Non-TDE |
|
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
andspfile
: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:
-
Create a directory named
/home/oracle/migrate
.Tip
You can name themigrate
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 namemigrate
for simplicity and clarity. -
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.
-
Copy the following files into the new directory:
- Oracle Database Backup Module (
opc_install.jar
) - Your API
*.pem
key file.
- Oracle Database Backup Module (
-
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
-
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
-
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.
-
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.
-
Launch a new DB system using the backup you created in the preceding step. See Create a DB System from a Backup Using the Console for information on creating a new DB system from a backup.
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
Parameter | Description | Required |
---|---|---|
--config-file
|
The path to the oci-cli config file. The default path is as follows: |
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:
|
Yes |
--opc-installer-dir
|
The directory containing the |
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.
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