The following is an example of a Multi-tenant database restore script. This is intended only as an example and lacks any internal error checking and correction.
The restore script can be used as a pre-snapsync hook script to automatically restore the backups prior to the snapsync.
The example assumes that the backup directory contains
-
Autobackup controlfile.
-
CDB Root, PDB$SEED and desired PDB full or incremental backups.
-
Backup of all required archived logs.
Full backup script example:
run {
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE disk TO '/backups/%F';
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/backups/%U';
BACKUP INCREMENTAL LEVEL 0 AS BACKUPSET DATABASE ROOT TAG='CDB_FULL_BACKUP';
BACKUP INCREMENTAL LEVEL 0 AS BACKUPSET PLUGGABLE DATABASE 'PDB$SEED' TAG='SEED_BACKUP';
BACKUP INCREMENTAL LEVEL 0 AS BACKUPSET PLUGGABLE DATABASE CDOMLOPR1777PDB1 TAG='PDB_BACKUP';
BACKUP AS BACKUPSET ARCHIVELOG ALL TAG='ARC_BACKUP';
}
Incremental backup script example:
run {
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE disk TO '/backups/%F';
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/backups/%U';
BACKUP INCREMENTAL LEVEL 1 AS BACKUPSET DATABASE ROOT TAG='CDB_INC_BACKUP';
BACKUP INCREMENTAL LEVEL 1 AS BACKUPSET PLUGGABLE DATABASE 'PDB$SEED' TAG='SEED_INC_BACKUP';
BACKUP INCREMENTAL LEVEL 1 AS BACKUPSET PLUGGABLE DATABASE CDOMLOPR1777PDB1 TAG='PDB_INC_BACKUP';
BACKUP AS BACKUPSET ARCHIVELOG ALL TAG='ARC_BACKUP';
}
Restore script example:
Download the following .bash script:
Last updated
Oct 9, 2026