Mastering Oracle 12c Multitenant Backup & Recovery: A Step‑by‑Step Guide
An in‑depth exploration of Oracle 12c’s multitenant architecture explains key concepts, analyzes a real‑world backup failure, and provides a comprehensive, step‑by‑step RMAN procedure—including control file handling, datafile restoration, and selective tablespace skipping—to reliably recover pluggable databases.
Basic Concepts
Oracle 12c introduced a multitenant architecture that separates a container database (CDB) from pluggable databases (PDB). The CDB consists of a root container (CDB$ROOT), a seed container (PDB$SEED), and one or more user PDBs, each storing isolated business data while sharing a single instance.
RMAN (Recovery Manager) is the built‑in tool for physical backup and recovery, supporting full and incremental backups. Table spaces are logical storage structures that contain segments, extents, and data files. The System Change Number (SCN) records checkpoint and transaction order, stored in control files, data file headers, and redo logs.
Problem Background and Analysis
A data‑masking request required restoring production data to a test environment. Using a single‑tenant restore script caused numerous RMAN errors because required data files were missing:
RMAN>
run{
startup nomount pfile=/tmp/initPOOL1DB.ora;
restore controlfile from '/data/backup/itapdb.cf';
alter database mount;
catalog start with '/data/backup/';
set newname for database to '/data/itapdb/%U';
restore database;
switch datafile all;
recover database;
}
RMAN-03002: failure of restore command
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 99 found to restore
...The errors indicated missing data files belonging to other PDBs. Querying the control file and the v$datafile_header view showed that only the ITAPDB files had valid checkpoint SCNs, while files from other PDBs had SCN = 0, confirming that the backup set lacked those files.
Analysis revealed that in a multitenant CDB all PDBs share a single control file and redo logs. Restoring the whole CDB with a backup that contains only one PDB inevitably triggers “file not found” errors for the absent PDB data files.
Multitenant Backup and Recovery Methodology
To reliably restore a multitenant environment, the following procedure is recommended:
Backup all relevant containers : CDB$ROOT, PDB$SEED, and the target PDB(s).
RMAN> backup as compressed backupset pluggable database "CDB$ROOT","PDB$SEED",itapdb format '/new/%d_itapdb_%t_%U_%p';
RMAN> backup archivelog all format '/new/arch%t_%s_%p';
RMAN> backup current controlfile format '/new/cf_%U';Prepare the parameter file and start the instance in NOMOUNT .
SQL> startup nomount pfile=/tmp/initPOOL1DB.ora;Restore the control file and mount the database .
RMAN> restore controlfile from '/data/backup/itapdb.cf';
RMAN> alter database mount;Catalog the backup location (required because the restore environment differs from production). RMAN> catalog start with '/data/backup/'; Cross‑check backup sets to mark missing pieces as expired. RMAN> crosscheck backup; Restore data files for each container .
RMAN> run{
set newname for database to '/data/itapdb/%U';
restore database root; -- CDB$ROOT
restore database "PDB$SEED"; -- seed
restore database itapdb; -- target PDB
switch datafile all;
}Recover using archived redo logs, skipping unnecessary tablespaces .
RMAN> recover database skip forever tablespace
PDB2:SYSTEM, PDB2:USER, PDB2:SYSAUX, ... ;(Adjust the list to match the PDBs that should not be recovered.)
Open the database with RESETLOGS . RMAN> alter database open resetlogs; If the restore or recover steps stall, it may be due to an Oracle bug triggered by mismatched ASM+RAC production storage and non‑RAC test storage. Applying the appropriate MOS patch resolves the issue.
Problem Summary
Backup must include CDB$ROOT and PDB$SEED in addition to the target PDB.
During restore, explicitly specify which containers to restore; otherwise the shared control file will cause missing‑file errors.
Use recover database skip forever tablespace to omit tablespaces of PDBs that are not being restored.
Multitenant architecture reduces hardware resource pressure by allowing many small projects to share a single instance.
The presented methodology provides a forward‑compatible solution for Oracle 12c multitenant environments, helping production DBAs and data‑masking teams perform reliable backups and restores.
dbaplus Community
Enterprise-level professional community for Database, BigData, and AIOps. Daily original articles, weekly online tech talks, monthly offline salons, and quarterly XCOPS&DAMS conferences—delivered by industry experts.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
