RMAN CONVERT Transportable Tablespace with Data Pump

You can use this method only if the database character sets of your on-premises database and Oracle Database Cloud Service database are compatible.

This method is similar to the Data Pump Transportable Tablespace method, with the addition of the RMAN CONVERT command to enable transport between platforms with different endianness. Query V$TRANSPORTABLE_PLATFORM to determine if the on-premises database platform supports cross-platform tablespace transport and to determine the endian format of the platform. The Oracle Database Cloud Service platform is little-endian format.

To migrate tablespaces from your on-premises Oracle database to a database deployment on Database Cloud Service using RMAN, you perform these tasks:

  1. On the on-premises database host, prepare the database for the Data Pump transportable tablespace export.

  2. On the on-premises database host, invoke Data Pump Export to perform the transportable tablespace export.

  3. On the on-premises database host, invoke RMAN and use the CONVERT TABLESPACE command to convert the tablespace datafile to the Oracle Database Cloud platform format. Refer to the Oracle Database Backup and Recovery Reference for more information on the CONVERT command.

  4. Use a secure copy utility to transfer the Data Pump Export dump file and the converted tablespace datafiles to the Database Cloud Service compute node.

  5. Set the on-premises tablespaces back to READ WRITE.

  6. On the Database Cloud Service compute node, prepare the database for the tablespace import.

  7. On the Database Cloud Service compute node, invoke Data Pump Import and connect to the database.

  8. On the Database Cloud Service compute node, set the tablespaces in the database to READ WRITE mode.

  9. After verifying that the data has been imported successfully, you can delete the dump file.

RMAN CONVERT Transportable Tablespace with Data Pump: Example

This example provides a step-by-step demonstration of the tasks required to migrate tablespaces in an on-premises Oracle database to an Oracle Database Cloud Service database.

In this example, the on-premises database is on a Linux host.

  1. On the on-premises database host, prepare the database for the Data Pump transportable tablespace export.

    1. On the on-premises database host, create a directory in the operating system to use for the on-premises export.

      $ mkdir /u01/app/oracle/admin/orcl/dpdump/for_cloud
    2. On the on-premises database host, invoke SQL*Plus and log in to the on-premises database as the SYSTEM user.

      $ sqlplus system
      Enter password: <enter the password for the SYSTEM user>
    3. Create a directory object in the on-premises database to reference the operating system directory.

      SQL> CREATE DIRECTORY dp_for_cloud AS '/u01/app/oracle/admin/orcl/dpdump/for_cloud';
    4. On the on-premises database host, set all tablespaces that will be transported (the transportable set) to READ ONLY mode.

      SQL> ALTER TABLESPACE fsindex READ ONLY;
      Tablespace altered.
      SQL> ALTER TABLESPACE fsdata READ ONLY;
      Tablespace altered.
    5. Exit from SQL*Plus.

  2. On the on-premises database host, invoke Data Pump Export to perform the transportable tablespace export.

    On the on-premises database host, invoke Data Pump Export and connect to the on-premises database. Export the on-premises tablespaces using the TRANSPORT_TABLESPACES option. Provide the password for the SYSTEM user when prompted.

    $ expdp system TRANSPORT_TABLESPACES=fsdata,fsindex TRANSPORT_FULL_CHECK=YES DIRECTORY=dp_for_cloud
  3. On the on-premises database host, invoke RMAN and use the CONVERT TABLESPACE command to convert the tablespace datafile to the Oracle Database Cloud platform format.

    1. Invoke RMAN.

      $ rman target /
    2. Execute the RMAN CONVERT TABLESPACE command to convert the datafiles and store the converted files in a temporary location on the on-premises database host.

      RMAN> CONVERT TABLESPACE fsdata, fsindex
         2> TO PLATFORM 'Linux x86 64-bit'
         3> FORMAT '/tmp/%U ';
      …
      input datafile file number=00006 name=/u01/app/oracle/oradata/orcl/fsdata01.dbf
      converted datafile=/tmp/data_D-ORCL_I-1410251631_TS-FSDATA_FNO-6_0aqc9un3
      …
      input datafile file number=00007 name=/u01/app/oracle/oradata/orcl/fsindex01.dbf
      converted datafile=/tmp/data_D-ORCL_I-1410251631_TS-FSINDEX_FNO-7_0bqc9un6
      …
    3. Take note of the names of the converted files. You will copy these files to the Database Cloud Service compute node in the next step.

    4. Exit RMAN.

  4. Use a secure copy utility to transfer the Data Pump Export dump file and the converted tablespace datafiles to the Database Cloud Service compute node.

    In this example the dump file is copied to the /u01 directory. Choose the appropriate location based on the size of the file that will be transferred.

    1. On the Database Cloud Service compute node, create a directory for the dump file.

      $ mkdir /u01/app/oracle/admin/ORCL/dpdump/from_onprem
    2. Before using the scp command to copy files, make sure the SSH private key that provides access to the Database Cloud Service compute node is available on your on-premises host. For more information about SSH keys, see About Network Access to Database Cloud Service.

    3. On the on-premises database host, use the scp utility to transfer the dump file and all datafiles of the transportable set to the Database Cloud Service compute node.

      $ scp -i private_key_file \
      /u01/app/oracle/admin/orcl/dpdump/for_cloud/expdat.dmp \
      oracle@IP_address_DBaaS_VM:/u01/app/oracle/admin/ORCL/dpdump/from_onprem
      
      $ scp -i private_key_file \
      /tmp/data_D-ORCL_I-1410251631_TS-FSDATA_FNO-6_0aqc9un3 \
      oracle@IP_address_DBaaS_VM:/u02/app/oracle/oradata/ORCL/fsdata01.dbf
      
      $ scp -i private_key_file \
      /tmp/data_D-ORCL_I-1410251631_TS-FSINDEX_FNO-7_0bqc9un6 \
      oracle@IP_address_DBaaS_VM:/u02/app/oracle/oradata/ORCL/fsindex01.dbf
  5. Set the on-premises tablespaces back to READ WRITE.

    1. Invoke SQL*Plus and log in as the SYSTEM user.

    2. Set the FSDATA and FSINDEX tablespaces back to READ WRITE mode.

      SQL> ALTER TABLESPACE fsdata READ WRITE;
      Tablespace altered.
      SQL> ALTER TABLESPACE fsindex READ WRITE;
      Tablespace altered.
    3. Exit from SQL*Plus.

  6. On the Database Cloud Service compute node, prepare the database for the tablespace import.

    1. On the Database Cloud Service compute node, invoke SQL*Plus and log in to the database as the SYSTEM user.

    2. Create a directory object in the Database Cloud Service database.

      SQL> CREATE DIRECTORY dp_from_onprem AS '/u01/app/oracle/admin/ORCL/dpdump/from_onprem';
    3. If the owners of the objects that will be imported do not exist in the database, create them before performing the import. The transportable tablespace mode of import does not create the users.

      SQL> CREATE USER fsowner
        2  PROFILE default
        3  IDENTIFIED BY fspass
        4  TEMPORARY TABLESPACE temp
        5  ACCOUNT UNLOCK;
  7. On the Database Cloud Service compute node, invoke Data Pump Import and connect to the database.

    Import the data into the DBaaS database using the TRANSPORT_DATAFILES option

    $ impdp system DIRECTORY=dp_from_onprem \
    TRANSPORT_DATAFILES='/u02/app/oracle/oradata/ORCL/fsdata01.dbf', \
    '/u02/app/oracle/oradata/ORCL/fsindex01.dbf'
  8. On the Database Cloud Service compute node, set the tablespaces in the database to READ WRITE mode.

    1. Invoke SQL*Plus and log in as the SYSTEM user.

    2. Set the FSDATA and FSINDEX tablespaces to READ WRITE mode.

      SQL> ALTER TABLESPACE fsdata READ WRITE;
      Tablespace altered.
      SQL> ALTER TABLESPACE fsindex READ WRITE;
      Tablespace altered.
    3. Exit from SQL*Plus.

  9. After verifying that the data has been imported successfully, you can delete the expdat.dmp dump file.