RMAN Pluggable Database Backup and Recovery
3c. File# however is unique so you can backup datafiles when connected to ROOT without having to specify the container name if you use file#:
To backup datafile 3 from CDB$ROOT and datafile 20 from PDB T12CPDB1
What is a Container Database?
A 12c database is either a non-Container Database or a Container Database - from here on referred to as non-CDB or CDB respectively.
All databases created prior to 12c are non-CDBs.
A CDB is an Oracle database that includes zero, one, or many customer-created Containers or Pluggable Databases referred to as PDB.
The CDB has:
A 12c database is either a non-Container Database or a Container Database - from here on referred to as non-CDB or CDB respectively.
All databases created prior to 12c are non-CDBs.
A CDB is an Oracle database that includes zero, one, or many customer-created Containers or Pluggable Databases referred to as PDB.
The CDB has:
- one ROOT container (CDB$ROOT) containing SYSTEM, SYSAUX, UNDO, and TEMP tablespaces, Controlfiles and Redologs
- one SEED container (PDB$SEED) containing SYSTEM, SYSAUX, TEMP, EXAMPLE tablespaces, used as a template to create new PDBs
What is a Pluggable Database?
A pluggable Database (PDB) is a user-created container holding the data and code for a specific application eg HR, Payroll etc.
A PDB:
A pluggable Database (PDB) is a user-created container holding the data and code for a specific application eg HR, Payroll etc.
A PDB:
- has SYSTEM, SYSAUX, TEMP tablespaces
- contains any number of other user created tablespaces
- writes to the container UNDO tablespace, controlfiles and redologs
Undo and redo is annotated with details of the PDB that they belong to.
RMAN Pluggable Database Backup
The RMAN user must have either SYSDBA or the new SYSBACKUP priviledge.
RMAN can be run from ROOT container: rman target sys/<pw>@t12ccdb
rman target /
or from the PDB: rman target sys/<pw>@t12cpdb1
When connected to a PDB, all commands pertain to that PDB only.
When connected to ROOT, commands pertain to any file in the CDB unless qualified by the PDB name.
RMAN command REPORT SCHEMA can be used to identify the files in a Container Database.
This example shows a CDB (T12cCDB) with one PDB (T12cPDB1):
RMAN Pluggable Database Backup
The RMAN user must have either SYSDBA or the new SYSBACKUP priviledge.
RMAN can be run from ROOT container: rman target sys/<pw>@t12ccdb
rman target /
or from the PDB: rman target sys/<pw>@t12cpdb1
When connected to a PDB, all commands pertain to that PDB only.
When connected to ROOT, commands pertain to any file in the CDB unless qualified by the PDB name.
RMAN command REPORT SCHEMA can be used to identify the files in a Container Database.
This example shows a CDB (T12cCDB) with one PDB (T12cPDB1):
1. Complete CDB backup
Backup CDB$ROOT, PDB$SEED and ALL PDBS:
Backup CDB$ROOT, PDB$SEED and ALL PDBS:
% rman target sys/<pw>@t12ccdb
RMAN> BACKUP DATABASE PLUS ARCHIVELOG ALL DELETE INPUT;
RMAN> LIST BACKUP OF DATABASE;
RMAN> BACKUP DATABASE PLUS ARCHIVELOG ALL DELETE INPUT;
RMAN> LIST BACKUP OF DATABASE;
2. Partial CDB backup
Backup only PDB T12CPDB1:
Backup only PDB T12CPDB1:
%rman target sys/<pw>@t12ccdb
RMAN>BACKUP PLUGGABLE DATABASE T12CPDB1 TAG 'T12CPDB1';
RMAN>LIST BACKUP;
RMAN>BACKUP PLUGGABLE DATABASE T12CPDB1 TAG 'T12CPDB1';
RMAN>LIST BACKUP;
3. Partial PDB backup
3a. Backup system and sysaux tablespace from PDB T12CPDB1 whilst connected to ROOT:
3a. Backup system and sysaux tablespace from PDB T12CPDB1 whilst connected to ROOT:
% rman target sys/<pw>@t12ccdb
RMAN>BACKUP TABLESPACE T12CPDB1:SYSTEM, T12CPDB1:SYSAUX;
RMAN>BACKUP TABLESPACE T12CPDB1:SYSTEM, T12CPDB1:SYSAUX;
3b. Backup system tablespace from pluggable database T12CPDB1 and the SYSAUX tablespace from ROOT CDB:
When connected to ROOT if you do not specify the PDB prefix, the ROOT container is assumed.
When connected to ROOT if you do not specify the PDB prefix, the ROOT container is assumed.
% rman target sys/<pw>@t12ccdb
RMAN>BACKUP TABLESPACE T12CPDB1:SYSTEM, SYSAUX;
RMAN>BACKUP TABLESPACE T12CPDB1:SYSTEM, SYSAUX;
3c. File# however is unique so you can backup datafiles when connected to ROOT without having to specify the container name if you use file#:
To backup datafile 3 from CDB$ROOT and datafile 20 from PDB T12CPDB1
% rman target sys/<pw>@t12ccdb
RMAN> BACKUP DATAFILE 3,20;
RMAN> BACKUP DATAFILE 3,20;
RMAN Pluggable Database Recovery
1. Loss of system datafile from PDB T12cPDB1
The Container Database and all other PDBs are unaffected, only PDB T12CPDB1 is unavailable.
Restore must be done from ROOT.
1. Loss of system datafile from PDB T12cPDB1
The Container Database and all other PDBs are unaffected, only PDB T12CPDB1 is unavailable.
Restore must be done from ROOT.
% rman target /
RMAN> RESTORE DATAFILE 8;
RMAN> RECOVER DATAFILE 8;
RMAN> ALTER PLUGGABLE DATABASE T12CPDB1 OPEN;
RMAN> RESTORE DATAFILE 8;
RMAN> RECOVER DATAFILE 8;
RMAN> ALTER PLUGGABLE DATABASE T12CPDB1 OPEN;
2. Loss of any non-system datafile from PDB eg datafile 10 USERS tablespace
Depending on the circumstances, the file may be already offlined if not - offline it:
% rman sys/<pw>@t12cpdb1
RMAN> ALTER DATABASE DATAFILE 10 OFFLINE;
RMAN> RESTORE DATAFILE 10;
RMAN> RECOVER DATAFILE 10;
RMAN> ALTER DATABASE DATAFILE 10 ONLINE;
RMAN> ALTER DATABASE DATAFILE 10 OFFLINE;
RMAN> RESTORE DATAFILE 10;
RMAN> RECOVER DATAFILE 10;
RMAN> ALTER DATABASE DATAFILE 10 ONLINE;
3. Loss of a complete tablespace from PDB
PDB T12CPDB1 remains open.
PDB T12CPDB1 remains open.
% rman target sys/oracle@t12ccpdb1
RMAN> ALTER TABLESPACE USERS OFFLINE;
RMAN> RESTORE TABLESPACE USERS;
RMAN> RECOVER TABLESPACE USERS;
RMAN> ALTER TABLESPACE USERS ONLINE;
RMAN> ALTER TABLESPACE USERS OFFLINE;
RMAN> RESTORE TABLESPACE USERS;
RMAN> RECOVER TABLESPACE USERS;
RMAN> ALTER TABLESPACE USERS ONLINE;
4: Loss of entire PDB
% rman target sys/<pw>@t12ccdb
RMAN> RESTORE PLUGGABLE DATABASE T12CPDB1;
RMAN> RECOVER PLUGGABLE DATABASE T12CPDB1;
RMAN> ALTER PLUGGABLE DATABASE T12cPDB1 open;
RMAN> RESTORE PLUGGABLE DATABASE T12CPDB1;
RMAN> RECOVER PLUGGABLE DATABASE T12CPDB1;
RMAN> ALTER PLUGGABLE DATABASE T12cPDB1 open;
*******************************************************************
Thank You
**********************************************************************
Comments
Post a Comment
Oracle DBA Information