June 14, 2018

Migrating an Oracle database to an Oracle Database Service Virtual Machine on OCI.

By: Rajeev Thottathil | Solution Architect


This blog post outlines the process of migrating a single instance, Oracle 12.2 database from on-premises, AWS or an instance in the Oracle cloud infrastructure to the Oracle database service virtual machine shape on OCI. If your source database is on the linux operating system you can easily accomplish this database migration by taking a backup of the source database using Recovery manager and restoring it onto the database service VM instance on Oracle cloud infrastructure.

Before you start

Before you perform the migration, you should consider the following 


  • Identify the cpu, memory, storage, Iops and Io throughput requirements for your database instance and provision an Oracle Database Service Virtual machine instance on OCI , that is large enough to handle those requirements.
  • Keep the database name for the source and target database exactly the same. (Eg: prddb. It is ok if he DB_UNIQUE_NAME and SERVICE_NAME's are different).
  • In this example we assume that the datafiles files are created as Oracle Managed files.
  • If the tablespaces in the source database is not encrypted, consider encrypting them before moving the database to the Oracle Cloud infrastructure.
    • Alternatively you can convert the un-encrypted tablespaces to TDE after the migration.
  • Identify the patch level of the source database.
    • Identify the bundle patch levels (Cpu, Psu, Ru, Rur) of the source database, and any critical one off patches that you might need.
    •  The database home on the Oracle database service instance in OCI is usually patched up to the latest version of the Bundle patches.
    •   If possible, apply the patch bundle that matches the oracle database service instance on the source database.
      •     Alternatively you can run the datapatch.sql to patch the database objects, once the database migration is complete.
  • Validate the list of one off patches with oracle support and get them backported if needed.
  • Determine the backup destination
    • Determine whether you want to use block storage to store the rman backup or oci object storage.
    • If you want to use the oci object storage, make sure that you install and configure the cloud backup module on the source instance.
  • Ensure that the source database is in Archivelog mode.
  • Create a new database service VM instance on Oracle Cloud infrastructure with the database name, the same as your source database.

Perform a backup

First  we perform a full backup of the source database and archivelogs, and transfer the backup set to the destination database instance.

Note down the dbid of the source database. We will need this to perform the restore on the target database instance.

       sqlplus / as sysdba
       SQL> select dbid from v$database;

Note down the file names for the online redo logs. We will need this information, so that we can rename these redo log files, on the Oracle database service instance to use Automatic storage management disk groups.

       sqlplus / as sysdba
       SQL> select member from v$logfile;