RMAN Cross-Platform Transportable Tablespace Backup Sets

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

Note

For detailed information on a similar method that enables you to perform a cross-platform transport of an entire database, see the Oracle Database 12c Backup and Recovery User's Guide for Release 12.2 or 12.1 . When you transport an entire database to a different platform, the source platform and the destination platform must use the same endian format.

To migrate Oracle Database 12c on-premises tablespaces to an Oracle Database 12c database on a Database service deployment using the RMAN cross-platform transportable backup sets method, you perform these tasks:

  1. On the on-premises database host, prepare the database by placing the user-defined tablespaces that you intend to transport in READ ONLY mode.

  2. On the on-premises database host, invoke RMAN and use the BACKUP command with the TO PLATFORM or FOR TRANSPORT clause and the DATAPUMP clause to create a backup set for cross-platform transport. See in "BACKUP" in Oracle Database Backup and Recovery Reference for Release 12.2 or 12.1 for more information on the BACKUP command.

  3. Use a secure copy utility to transfer the backup sets, including the Data Pump export dump file, to the Database service compute node.

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

  5. On the Database service compute node, prepare the database by creating the required schemas.

  6. On the Database service compute node, invoke RMAN and use the RESTORE command with the foreignFileSpec subclause to restore the cross-platform backup.

  7. On the Database service compute node, set the tablespaces on the database to READ WRITE mode.

For more information, see "Overview of Cross-Platform Data Transport Using Backup Sets" in Oracle Database Backup and Recovery User's Guide for Release 12.2 or 12.1.

RMAN Cross-Platform Transportable Tablespace Backup Sets: Example

This example provides a step-by-step demonstration of the tasks required to migrate tablespaces in an Oracle Database PDB to a Database service database.

This example performs a migration of the FSDATA and FSINDEX tablespaces.

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

  1. On the on-premises database host, prepare the database by creating a directory for the export dump file and placing the user-defined tablespaces that you intend to transport in READ ONLY mode..

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

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

      sqlplus system@pdb_servicename 
      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;
      SQL> ALTER TABLESPACE fsdata READ ONLY;
    5. Exit from SQL*Plus.

  2. On the on-premises database host, invoke RMAN and use the BACKUP command with the TO PLATFORM or FOR TRANSPORT clause and the DATAPUMP clause to create a backup set for cross-platform transport.

    1. On the on-premises database host, create an operating system directory for the datafiles.

      mkdir /u01/app/oracle/admin/orcl/rman_transdest
    2. Invoke RMAN and log in as a user that has been granted the SYSDBA or SYSBACKUP privilege.

      rman target username@pdb_servicename 
    3. Execute the BACKUP command.

      RMAN> BACKUP FOR TRANSPORT
      2> FORMAT '/u01/app/oracle/admin/orcl/rman_transdest/fs_tbs.bck'
      3> TABLESPACE fsdata,fsindex
      4> DATAPUMP FORMAT '/u01/app/oracle/admin/orcl/rman_transdest/fs_tbs.dmp';
    4. Log out of RMAN.

    5. Optionally, navigate to the directory you specified in the BACKUP command to view the files that were created.

      cd /u01/app/oracle/admin/orcl/rman_transdest
      $ ls
      fs_tbs.bck  fs_tbs.dmp
  3. Use a secure copy utility to transfer the backup set, including the Data Pump export dump file, to the Database service compute node.

    1. On the Database service compute node, create a directory for the backup set and dump file.

      mkdir /tmp/from_onprem
    2. Before using the scp command to copy files, make sure the SSH private key that provides access to the Database service compute node is available on your on-premises host.

    3. On the on-premises database host, use the SCP utility to transfer the backup set and the dump file to the Database service compute node.

      scp -i private_key_file \
      /u01/app/oracle/admin/orcl/rman_transdest/fs_tbs.bck \
      oracle@IP_address_DBaaS_VM:/tmp/from_onprem
      
      $ scp -i private_key_file \
      /u01/app/oracle/admin/orcl/rman_transdest/fs_tbs.dmp \
      oracle@IP_address_DBaaS_VM:/tmp/from_onprem
      
      $ 
  4. Set the on-premises tablespaces back to READ WRITE.

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

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

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

  5. On the Database service compute node, prepare the database by creating the required schemas.

    1. On the Database service compute node, invoke SQL*Plus and log in to the PDB as the SYSTEM user.

    2. If the owners of the objects that will be imported do not exist in the database, create them before performing the RESTORE.

      SQL> CREATE USER fsowner
        2  PROFILE default
        3  IDENTIFIED BY fspass
        4  TEMPORARY TABLESPACE temp
        5  ACCOUNT UNLOCK;
  6. On the Database service compute node, invoke RMAN and use the RESTORE command with the foreignFileSpec subclause to restore the cross-platform backup.

    1. Create an operating system directory for the Data Pump Dump file.

      mkdir /tmp/from_onprem
    2. Invoke RMAN and log in to the PDB as a user that has been granted the SYSDBA or SYSBACKUP privilege.

      rman target username@pdb_servicename
    3. Execute the RESTORE command.

      RMAN> RESTORE FOREIGN TABLESPACE fsdata,fsindex TO NEW
      2> FROM BACKUPSET '/tmp/from_onprem/fs_tbs.bck'
      3> DUMP FILE DATAPUMP DESTINATION '/tmp/datapump'
      4> FROM BACKUPSET '/tmp/from_onprem/fs_tbs.dmp';
    4. Exit from RMAN.

  7. On the Database service compute node, set the tablespaces to READ WRITE mode.

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

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

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

  8. After verifying that the data has been imported successfully, you can delete the backup set files that were transported from the on-premises host.