Redgate Clone

Creating an Oracle data image from an RMAN backup


Tutorial (step-by-step)

Create a backup

We need a full RMAN backup with archive logs in order to create an Oracle data-image. If you are unfamiliar with RMAN you may wish to consult the official Oracle documentation before proceeding, however the following steps should be all you need to get a working backup.

Your database will need to be in ARCHIVELOG mode before restoring a backup. The following SQLPlus commands will enable that feature.

Be aware that these commands will restart your database

Enable ARCHIVELOG

sqlplus <connection-string> as sysdba
SHUTDOWN IMMEDIATE 
STARTUP MOUNT
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;
ARCHIVE LOG LIST
quit


Connect to the database through RMAN and backup the database to the file-system on the database server as follows:

You may wish to change the directory that the backups are being saved to to something other than `/host/backups/` – however be aware that the directory must already exist before running the backup commands.

RMAN Backup

rman target <connection-string>
backup database format '/host/backups/%U';
backup archivelog all format '/host/backups/ARC_%U';
backup current controlfile format '/host/backups/control.bks';
backup spfile format '/host/backups/spfile.bks';
quit


After completing the backup you should move the four files from the /host/backups/ folder into a directory within the fileshare that your administrator has specified in the Admin Console for use with Redgate Clone.

In this example we will assume the folder is at backups/oracle-backup-image/.

Create a data image yaml file

Now that we've got a backup folder containing the files produced by RMAN we can create our data image definition YAML file with the following contents:

# ~/rgclone/oracle-backup.yaml
sourceType: backup
name: oracle-backup
engine: oracle
version: 19-ee
backups:
- path: backups/oracle-backup-image/

This instructs Redgate Clone to create a data image called oracle-backup on Oracle 19 Enterprise Edition. It will locate the folder specified when creating the image within the Redgate Clone fileshare to restore that backup using RMAN, snapshot the state of the restored database and then produce the data image ready for consumption.

Create the image

Run:

rgclone create data-image --file=./oracle-backup.yaml

This will create the data image from the backup defined in the YAML file we created.

Database SID

Your backup will be restored into the ORCLDB database for Standard / Enterprise Edition, or XE for Express Edition.


Didn't find what you were looking for?