| Img-01 |
Oracle introduced the Multitenant Architecture in Oracle 12c, and it became even better in Oracle 19c. This architecture makes it easier to manage many databases by allowing multiple Pluggable Databases (PDBs) to run inside one main Container Database (CDB) Shown in above Image (Img-01) . It helps DBAs simplify tasks like administration, patching, backup, and recovery.
For DBAs working in a multitenant
setup, one of the key things to understand is how to properly back up and
recover both the CDB and individual PDBs. Oracle 19c gives us strong and
flexible tools; especially RMAN to protect our data and reduce downtime.
This blog gives a simple, practical
explanation of how to handle backup and recovery in a multitenant environment.
1. Understanding CDB and PDB Backup Architecture
A backup taken at the CDB level
covers everything inside the database environment. It includes the root
container (CDB$ROOT), all pluggable databases whether they are open or closed,
and also the control files and redo logs of the CDB. This type of backup is
best when you want full protection for the entire database setup.
A PDB-level backup is different
because Oracle 19c allows you to back up each pluggable database separately.
When you back up a PDB, it only includes that particular PDB and its own
datafiles. It does not include anything that belongs to the CDB, such as
control files or the root container. This kind of backup is helpful when
tenants maintain their own backups or when only one PDB needs to be restored to
an earlier point in time. Refer below Image (Img-02) for more details.
| Img-02 |
2. Backup of the Container Database (CDB)
2.1
Full CDB Backup
A full CDB backup makes sure that the entire database i.e. both
the root and all PDB’s can be restored if needed.
RMAN Full Backup Example:
rman target /
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
OR
RMAN> RUN {
BACKUP AS COMPRESSED BACKUPSET DATABASE;
BACKUP CURRENT CONTROLFILE;
BACKUP SPFILE;
BACKUP ARCHIVELOG ALL;
}
This
command backs up:
- All containers (CDB$ROOT)
- All PDBs
- Control file
- SPFILE
- Archive logs
2.2 CDB Control File Backup
BACKUP CURRENT CONTROLFILE;
2.3 CDB SPFILE Backup
BACKUP SPFILE;
2.4 Tablespace Level Backup in CDB
BACKUP TABLESPACE users;
Tablespaces in root or individual
PDBs can be backed up at the CDB level, but PDB-level granularity applies. RMAN backs up datafiles regardless of
whether the PDB is open or closed, as long as the CDB instance is available.
3. Backup of a Pluggable Database (PDB)
Oracle 19c lets you back up a PDB by
itself, which is very helpful when many customers or tenants share the same
database i.e. in multi-tenant hosting environments.
3.1 Connect to the PDB
sqlplus / as sysdba
ALTER SESSION SET CONTAINER=pdb1;
3.2 Backup the PDB
rman target /
RMAN> BACKUP PLUGGABLE DATABASE pdb1;
3.3 PDB with Archive Logs
RMAN> BACKUP PLUGGABLE DATABASE pdb1 PLUS ARCHIVELOG;
4. Recovery of CDB and PDB
Recovery is the part where the multitenant architecture
really proves how flexible it is.
4.1 Recovering the Entire CDB
If the CDB suffers corruption or major failure
Mount the CDB
sqlplus / as sysdba
STARTUP MOUNT;
RMAN Restore and Recover
rman target /
RMAN> RESTORE DATABASE;
RMAN> RECOVER DATABASE;
Open the Database
ALTER DATABASE OPEN;
4.2 Recovering a Specific PDB
Recovering a pluggable database helps make sure that any
problem is limited to just that one tenant’s database and doesn’t affect
others. Meaning Pluggable database recovery allows isolation of failure to only
that tenant.
4.2.1 Close the PDB
ALTER PLUGGABLE DATABASE pdb1 CLOSE IMMEDIATE;
4.2.2 Startup the PDB in Mount Mode
ALTER PLUGGABLE DATABASE pdb1 MOUNT;
4.2.3 Restore and Recover the PDB
rman target /
RMAN> RESTORE PLUGGABLE DATABASE pdb1;
RMAN> RECOVER PLUGGABLE DATABASE pdb1;
4.2.4 Open the PDB
ALTER PLUGGABLE DATABASE pdb1 OPEN;
5. Point-in-Time Recovery (PITR)
5.1
CDB-Level PITR
This restores entire CDB to a
previous point.
5.2
PDB-Level PITR
Most powerful multitenant feature:
recover only one PDB without affecting others.
Example
RMAN> RECOVER PLUGGABLE DATABASE pdb1
UNTIL TIME "TO_DATE('2025-05-23 10:00:00','YYYY-MM-DD HH24:MI:SS')";
Oracle creates an auxiliary instance internally for PDB PITR.
6. Best Practices for Multitenant Backup and Recovery
✔ Enable ARCHIVELOG mode
✔ Perform frequent CDB-level backups
✔ Allow tenants to manage PDB backups independently if
required
✔ Store backups in separate FRA locations for large
environments
✔ Use BLOCK CHANGE TRACKING to speed up incremental
backups
ALTER DATABASE
ENABLE BLOCK CHANGE TRACKING USING FILE '/u01/bct.dbf';
✔ Test restore and recovery regularly
✔ Use cataloged RMAN backups for enterprise
environments
Conclusion
Oracle
19c’s Multitenant Architecture gives DBAs strong and flexible tools to back up
and recover the entire Container Database as well as individual Pluggable
Databases. Backups taken at the CDB level protect the whole system, while
PDB-level backups and point‑in‑time recovery allow you to restore just one PDB
when needed. This helps reduce downtime and keeps issues isolated.
By
understanding and using the right multitenant backup strategies, organizations
can improve availability, protect each tenant’s data, and maintain a reliable
environment for critical applications.
Thanks for reading !
No comments:
Post a Comment