Part 6/10: Migration Methods using RMAN
This is part 6 of our blog series about migrating Oracle databases to Oracle Cloud. In this part we will introduce the following migration methods using RMAN:
- RMAN Transportable Tablespace with Data Pump
- RMAN Convert Transportable Tablespace with Data Pump
- RMAN Cross-Platform Transportable Tablespace Backup Sets
- RMAN Cross-Platform Transportable PDB
- RMAN Cross-Platform Transportable PDB Inconsistent Backups
- RMAN Duplicate from an Active Database
- RMAN Backup & Restore
RMAN
Oracle Recovery Manager (RMAN) is the tool used for efficiently backing up and recovering the Oracle database. RMAN is also used to facilitate database migrations on-premises and from on-premise to the Cloud.
It can be used to migrate source databases from version 11g onwards. As it moves data files or their backups at the physical block level, it is a matter of physical migration methods that require access to the underlying database infrastructure. Hence, the targets are Oracle databases on Oracle Database Cloud Service (DBCS). RMAN also supports migrations across different platforms by allowing conversion between different endian formats.
After introducing Data Guard and Golden Gate in part 4 and Data Pump in part 5, now we continue our journey with further migration methods using RMAN:
7. RMAN Transportable Tablespace with Data Pump
Data Pump Transportable Tablespace (method number 5 in part 4 of this series) requires placing the tablespaces on-premise in Read-Only mode. RMAN eliminates this requirement and provides the Transportable Tablespace method while the database on-premise is still online and fully available.
The migration steps consist of:
- On-premise, invoke RMAN to create the transportable tablespace set.
- Use the scp utility to copy the tablespace data files and Data Pump dump files (containing the metadata) to the DBCS compute node in the cloud.
- Create the schemas on the target database in the cloud.
- On the DBCS compute node, invoke Data Pump import with the TRANSPORT_DATAFILES parameter.
For detailed steps and code examples have a look at:
- RMAN Transportable Tablespace with Data Pump at Oracle doc.
8. RMAN Convert Transportable Tablespace with Data Pump
RMAN can also be used to convert the data files to a different endian format. This is also similar to Data Pump Transportable Tablespace (method number 5 in part 4 of this series), but adding a step to convert the database data files to a different endian format using the RMAN CONVERT command. You will use this method if you are running your database on-premise on a big-endian platform.
The migration steps consist of:
- Set the tablespaces on-premise in Read-Only mode.
- Invoke Data Pump export with the TRANSPORT_TABLESPACES parameter.
- Invoke RMAN using the CONVERT TABLESPACE command to convert the tablespace data files to the cloud platform endian format (little-endian).
- Copy the generated dump files along with the converted tablespace data files to the target system in the cloud.
- Create the schemas on the target database in the cloud.
- On the DBCS compute node, invoke Data Pump import with the TRANSPORT_DATAFILES parameter.
- Set the tablespaces on the target database in Read-Write mode.
For detailed steps and code examples have a look at:
- RMAN CONVERT Transportable Tablespace with Data Pump at Oracle doc.
9. RMAN Cross-Platform Transportable Tablespace Backup Sets
If you cannot run the CONVERT command because the data files are encrypted, use backup sets instead, which does not require the CONVERT operation. In this case, you have to backup and restore the data blocks instead of just copying the data files.
The migration steps consist of:
- Set the tablespaces on-premise in Read-Only mode.
- Invoke RMAN using the BACKUP FOR TRANSPORT command to create the backup set.
- Copy the generated dump files along with the backup set files to the target system in the cloud.
- Create the schemas on the target database in the cloud.
- On the DBCS compute node, invoke RMAN with the RESTORE FOREIGN TABLESPACE command to restore the data into the target database.
- Set the tablespaces on the target database in Read-Write mode.
For detailed steps and code examples have a look at:
- RMAN Cross-Platform Transportable Tablespace Backup Sets at Oracle doc.
10. RMAN Cross-Platform Transportable PDB
Pluggable databases can be transported and restored into a destination multitenant container database on a different platform than the source CDB. In addition to the backup of the PDB, RMAN also copies the metadata required to plug the PDB into the destination CDB.
The migration steps consist of:
- Close the PDB on-premise.
- Invoke RMAN using the BACKUP FOR TRANSPORT UNPLUG INTO command to create a full database backup and generate the XML file that contains the metadata of the PDB.
- Copy the generated backup files along with the XML file to the target system in the cloud.
- On the DBCS compute node, invoke RMAN with the RESTORE USING ... FOREIGN PLUGGABLE DATABASE command.
- Upgrade the PDB if your target DBCS has a higher release version than on-premise.
- Open the target PDB in Read-Write mode.
For detailed steps and code examples have a look at:
- RMAN Cross-Platform Transportable PDB at Oracle doc.
- RMAN Cross-Platform Transport of PDB into Destination CDB blog.
11. RMAN Cross-Platform Transportable PDB Inconsistent Backups
To achieve a much shorter downtime, use inconsistent backups where the PDB incremental level 0 backup is taken while the PDB is open in Read-Write mode. Thereafter, take one or more incremental level 1 backup and apply them to the target database to keep it as far in sync to the source as possible. Finally, close the PDB to perform a final incremental level 1 backup and get the PDBs' metadata.
The downtime needed using this method is only for what is needed for the last incremental level 1 backup and recovery (and the upgrade in case of different release versions).
The migration steps consist of:
- On-premise, invoke RMAN using BACKUP INCREMENTAL LEVEL 0 FOR TRANSPORT ALLOW INCONSISTENT command.
- Copy the generated backup files to the target host in the cloud.
- On the DBCS compute node, invoke RMAN with the RESTORE FOREIGN PLUGGABLE DATABASE command.
- Create an incremental level 1 backup on-premise, copy the backups to the cloud, and apply them to the target database to keep it as close as possible to the source database. The source database on-premise is still online and fully available.
- Close the PDB on-premise.
- On-premise, invoke RMAN with the BACKUP INCREMENTAL FROM SCN … FOR TRANSPORT UNPLUG INTO command to create the final incremental level 1 backup and generate the XML file containing the PDB metadata.
- Copy the generated backup files along with the XML file to the target system in the cloud.
- On the DBCS compute node, invoke RMAN with the RECOVER USING ... FOREIGN DATAFILECOPY command.
- Upgrade the PDB if your target DBCS has a higher release version than on-premise.
- Open the target PDB in Read-Write mode.
For detailed steps and code examples have a look at:
12. RMAN Duplicate from an Active Database
RMAN also provides the DUPLICATE command to duplicate a database on a remote server on-premise or in the cloud. The duplication can be based on a backup or an active database. Active database duplication copies the live database over the network to the auxiliary destination and then creates the duplicate database. Using this method, you can migrate an entire active CDB database to the cloud.
The very high-level migration steps consist of:
- Create an auxiliary instance in the cloud.
- On the DBCS compute node, invoke RMAN with the DUPLICATE command.
For detailed steps and code examples have a look at:
- RMAN DUPLICATE from an Active Database at Oracle doc.
13. RMAN Backup & Restore
It is also possible to just use a conventional full backup and restore to migrate an Oracle database across platforms.
The very high-level migration steps consist of:
- Close the PDB on-premise.
- Create a full consistent backup.
- Copy the backup to OCI Object Storage.
- On the DBCS compute node, invoke RMAN to restore the database.
Oracle also provides the Oracle Database Backup Cloud Service to backup Oracle databases on-premise to OCI Object Storage.
You also can use the Backup Service as your main backup strategy and benefit from having your backups highly available on a different data center for disaster recovery.
Conclusion
RMAN provides different ways to migrate an Oracle database across platforms by using backup and restore scenarios, including converting the database data files for cross endian platform migrations. Using inconsistent backups you can minimize the downtime to the time needed to create and apply one last incremental level 1 backup.
As a physical migration method, it can be used to migrate your databases to Oracle Database Cloud Service (DBCS).
Next Blog
Part 7/10: Migration Methods using Multitenant Architecture.
If you have any comments or thoughts, you are very welcome to leave a comment and start a discussion. Thank you!