Upgrade and Migrate Your Database to the Cloud

Using this single step direct migration procedure, you can migrate your on-premise database to Oracle Cloud Infrastructure with near zero downtime and at the same time upgrade the database to the latest version. This migration procedure reduces cost, end-to-end migration time, and the testing effort required to migrate a database.

Upgrade to Oracle Database 18c

Restore the RMAN backup of the source 11.2.0.3 database under 18c Oracle Home and upgrade to Oracle Database18c.

With Oracle Database Exadata Cloud Service, it is assumed that the target container database is already created. The backup brought from the on-premise database is upgraded to 18c and plugged in as a pluggable database (PDB) in this pre-created container. Although the on-premise database backup is 11.2.0.3, you can restore it in an 18c DB Home on Oracle Database Exadata Cloud Service.

Use the SCN captured from the source RMAN backup when defining the Set until SCN. This is to ensure that we're restoring the database up to a certain point, this is also the starting point to start applying our change deltas from Oracle GoldenGate.

  1. Restore the RMAN backup of the source 11.2.0.3 database under the 18c Oracle Home.

    Only restore the database. Do not open the database after restore and recovery. This is because we want to upgrade our database to 18c.

    When running the RMAN command, the value for Set until SCN is the SCN captured from the source RMAN backup.

    RMAN> restore controlfile from '/rman_backups/cntrl_882_1_1005936032';
    
    RMAN> alter database mount;
    SQL "alter database rename file ''/oradata/bildb/bildb/onlinelog/thread1/redo1_1.log'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb_mirr/bildb/onlinelog/thread1/redo1_2.log'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb/bildb/onlinelog/thread1/redo2_1.log'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb_mirr/bildb/onlinelog/thread1/redo2_2.log'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb/bildb/onlinelog/thread1/redo3_1.log'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb_mirr/bildb/onlinelog/thread1/redo3_2.log'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb/bildb/onlinelog/thread1/redo30_1.log'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb_mirr/bildb/onlinelog/thread1/redo30_2.log'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb/bildb/onlinelog/thread1/redo31_1.log'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb_mirr/bildb/onlinelog/thread1/redo31_2.log'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb/bildb/onlinelog/thread1/redo32_1.log'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb_mirr/bildb/onlinelog/thread1/redo32_2.log'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb/bildb/onlinelog/thread1/redo40_1.dbf'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb_mirr/bildb/onlinelog/thread1/redo40_2.dbf'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb/bildb/onlinelog/thread1/redo41_1.dbf'' to ''+RECOC1''";
    SQL "alter database rename file ''/oradata/bildb_mirr/bildb/onlinelog/thread1/redo41_2.dbf'' to ''+RECOC1''";
    
    RMAN> run
    {
    allocate channel ch1 type DISK ;
    allocate channel ch24 type DISK ;
    set until scn 2579195632075;
    set newname for database to '+DATAC1';
    restore database;
    switch datafile all;
    switch tempfile all;
    recover database;
    release channel ch1;
    release channel ch24;
    }
    
  2. Upgrade to Oracle Database version 18c.

    Open the database with the upgrade option and run the dbupgrade command.

    SQL> alter database open resetlogs upgrade
    $ORACLE_HOME/bin/dbupgrade -n 20
    SQL> @?/rdbms/admin/utlu122s.sql
    SQL> @?/rdbms/admin/catuppst.sql 
    SQL> @?/rdbms/admin/utlrp.sql
    
  3. Verify the timezone version by running the following statement in the target container.
    SQL> select * from v$timezone_file;
    
    FILENAME                VERSION     CON_ID
    -------------------- ---------- ----------
    timezlrg_31.dat              31          0
  4. If the timezone of the source database is not the latest timezone, update the timezone of upgraded database to the latest timezone in the cloud database.
    For example, if the timezone of the source database is 14, then it needs to be updated to the latest timezone version on cloud.

Convert the Database to a Container Database

Plug the non-container database into the target container as a pluggable database (PDB).

After updating the timezone, the non-container database is ready to be plugged in as a pluggable database in the target container. Since the database size is huge, you can create the PDB using the NOCOPY clause. When you use the NOCOPY clause, the same set of datafiles that belong to non-container database are repointed to the pluggable database instead of performing a copy operation. This saves time and space for huge databases.

The non-container database must be in READ ONLY mode for the plugin operation.
  1. Generate a pluggable database (PDB) descriptor file in the non-container database.
    SQL> alter database open read only;
    SQL>BEGIN
    DBMS_PDB.DESCRIBE(pdb_descr_file => '/tmp/bildb.xml');
    END;
    /
    SQL> shutdown immediate
    
  2. Create a PDB in the non-container database container and alter the session.
    SQL> SET SERVEROUTPUT ON;
    DECLARE
    compatible CONSTANT VARCHAR2(3) := CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY(pdb_descr_file => '/tmp/bildb.xml')
    WHEN TRUE THEN 'YES'
    ELSE 'NO'
    END;
    BEGIN
    DBMS_OUTPUT.PUT_LINE(compatible);
    END;
    /
    SQL> CREATE PLUGGABLE DATABASE bildb USING '/tmp/bildb.xml' SOURCE_FILE_NAME_CONVERT=('+DATA/bildb/DATAFILE','+DATA/bildb/DATAFILE','+DATA/bildb/TEMPFILE','+DATA/bildb/TEMPFILE') NOCOPY TEMPFILE REUSE;
    Pluggable database created.
    SQL>
    
    SQL> alter session set container=bildb;
    Session altered.
    
    SQL> show con_name
    CON_NAME
    ------------------------------
    BILDB
  3. Update the medata.
    SQL> @/u01/app/oracle/product/18.0.0.0/dbhome_1/rdbms/admin/noncdb_to_pdb.sql

Synchronize With the Source

Start change synchronization on the target database to apply change deltas and migrate the data.

After the database is restored and plugged in as pluggable database in the target container, the initial load for Oracle GoldenGate is complete. Start the change synchronization from the same SCN that you captured during RMAN backup taken from source database.

  1. Start the replicat command on the target database for change synchronization
    GGSCI (mlib-gghubtgt) 2> START REPLICAT rep18c, ATCSN 2579195632075
    After starting the replication, the changes from the on-premise database will start being applied to Oracle Database 18c on Oracle Cloud Infrastructure.
  2. For cutover, it is recommended to create a reverse replication path from an Oracle Database 18c in the cloud to an Oracle Database 11.2.0.3 on-premise. After cutover, the reverse replication path has to be enabled for transactions to flow from the cloud database to the on-premise 11.2.0.3 database.