RMAN Cross-Platform Transportable Tablespace Backup Sets
You can use this method only if the database character sets of your on-premises database and Oracle Database Classic Cloud Service database are compatible.
Note:
See Oracle Database 12c Backup and Recovery User's Guide for Release 12.2 or 12.1 for detailed information on a similar method that enables you to perform a cross-platform transport of an entire database. 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 an Oracle Database Classic Cloud Service deployment using the RMAN cross-platform transportable backup sets method, you perform these tasks:
-
On the on-premises database host, prepare the database by placing the user-defined tablespaces that you intend to transport in
READ ONLY
mode. -
On the on-premises database host, invoke RMAN and use the
BACKUP
command with theTO PLATFORM
orFOR TRANSPORT
clause and theDATAPUMP
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 theBACKUP
command. -
Use a secure copy utility to transfer the backup sets, including the Data Pump export dump file, to the Database Classic Cloud Service compute node.
-
Set the on-premises tablespaces back to
READ WRITE
. -
On the Database Classic Cloud Service compute node, prepare the database by creating the required schemas.
-
On the Database Classic Cloud Service compute node, invoke RMAN and use the
RESTORE
command with theforeignFileSpec
subclause to restore the cross-platform backup. -
On the Database Classic Cloud 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 an Oracle Database Classic Cloud 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.
-
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..
-
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
-
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
-
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';
-
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;
-
Exit from SQL*Plus.
-
-
On the on-premises database host, invoke RMAN and use the
BACKUP
command with theTO PLATFORM
orFOR TRANSPORT
clause and theDATAPUMP
clause to create a backup set for cross-platform transport.-
On the on-premises database host, create an operating system directory for the datafiles.
$ mkdir /u01/app/oracle/admin/orcl/rman_transdest
-
Invoke RMAN and log in as a user that has been granted the
SYSDBA
orSYSBACKUP
privilege.$ rman target username@pdb_servicename
-
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';
-
Log out of RMAN.
-
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
-
-
Use a secure copy utility to transfer the backup set, including the Data Pump export dump file, to the Database Classic Cloud Service compute node.
-
On the Database Classic Cloud Service compute node, create a directory for the backup set and dump file.
$ mkdir /tmp/from_onprem
-
Before using the
scp
command to copy files, make sure the SSH private key that provides access to the Database Classic Cloud Service compute node is available on your on-premises host. For more information about SSH keys, see About Network Access to Database Classic Cloud Service. -
On the on-premises database host, use the SCP utility to transfer the backup set and the dump file to the Database Classic Cloud 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 $
-
-
Set the on-premises tablespaces back to READ WRITE.
-
Invoke SQL*Plus and log in to the PDB as the
SYSTEM
user. -
Set the
FSDATA
andFSINDEX
tablespaces back to READ WRITE mode.SQL> ALTER TABLESPACE fsdata READ WRITE; SQL> ALTER TABLESPACE fsindex READ WRITE;
-
Exit from SQL*Plus.
-
-
On the Database Classic Cloud Service compute node, prepare the database by creating the required schemas.
-
On the Database Classic Cloud Service compute node, invoke SQL*Plus and log in to the PDB as the
SYSTEM
user. -
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;
-
-
On the Database Classic Cloud Service compute node, invoke RMAN and use the
RESTORE
command with theforeignFileSpec
subclause to restore the cross-platform backup.-
Create an operating system directory for the Data Pump Dump file.
$ mkdir /tmp/from_onprem
-
Invoke RMAN and log in to the PDB as a user that has been granted the
SYSDBA
orSYSBACKUP
privilege.$ rman target username@pdb_servicename
-
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';
-
Exit from RMAN.
-
-
On the Database Classic Cloud Service compute node, set the tablespaces to READ WRITE mode.
-
Invoke SQL*Plus and log in to the PDB as the
SYSTEM
user. -
Set the
FSDATA
andFSINDEX
tablespaces to READ WRITE.SQL> ALTER TABLESPACE fsdata READ WRITE; SQL> ALTER TABLESPACE fsindex READ WRITE;
-
Exit from SQL*Plus.
-
-
After verifying that the data has been imported successfully, you can delete the backup set files that were transported from the on-premises host.