17-18

Performing Complete Recovery of a Whole CDB

When you recover a whole CDB, you recover the root and all PDBs in a single operation.
RESTORE DATABASE;
RECOVER DATABASE;

Performing Complete Recovery of the Root

You might consider recovering only the root if a data corruption or user error occurs that affects only the root. However, Oracle strongly recommends that you recover all PDBs after recovering the root to prevent metadata inconsistencies among the root and the PDBs. In this case, it might be preferable to perform a complete recovery of the whole CDB.

SHUTDOWN IMMEDIATE
STARTUP MOUNT
RESTORE DATABASE ROOT;
RECOVER DATABASE ROOT;
Strongly recommended) Recover all PDBs, including the seed PDB.
a.Issue the RESTORE PLUGGABLE DATABASE and RECOVER PLUGGABLE DATABASE commands.
The following example recovers the PDBs sales and hr:
RESTORE PLUGGABLE DATABASE ’PDB$SEED’, sales, hr;
RECOVER PLUGGABLE DATABASE ’PDB$SEED’, sales, hr;
b.Examine the output to see if media recovery was successful. If so, proceed to the next step.
7.Open the CDB and all PDBs.
ALTER DATABASE OPEN;
ALTER PLUGGABLE DATABASE ALL OPEN;

Performing Complete Recovery of PDBs with RMAN

There are two approaches to recovering a PDB with RMAN:
■Connect to the root and then use the RESTORE PLUGGABLE DATABASE and RECOVER PLUGGABLE DATABASE commands. This approach enables you to recover multiple PDBs with a single command.
■Connect to the PDB and use the RESTORE DATABASE and RECOVER DATABASE commands. This approach recovers only a single PDB and enables you to use the same commands used for recovering non-CDB databases.

To recover one or more PDBs while connected to the root:

ALTER PLUGGABLE DATABASE sales, hr CLOSE;

If any data files are missing, an error occurs and you cannot close a PDB. You must then connect to the PDB to which the missing data file belongs, take the missing data file offline, and then close the PDB.
The following command takes the data file 12 offline:
ALTER PLUGGABLE DATABASE DATAFILE 12 OFFLINE;

Issue the RESTORE PLUGGABLE DATABASE and RECOVER PLUGGABLE DATABASE commands.
The following example recovers the seed database PDB$SEED and the PDBs sales and hr:
RESTORE PLUGGABLE DATABASE ‘pdb$seed’, sales, hr;
RECOVER PLUGGABLE DATABASE ‘pdb$seed’, sales, hr;

Connect to the PDB to which the missing data file belongs and then make the data file online. The following command makes the data file 12 online:
ALTER DATABASE DATAFILE 12 ONLINE;

Examine the output to see if media recovery was successful. If so, open the PDBs.
ALTER PLUGGABLE DATABASE sales, hr OPEN;

To connect to and recover one PDB:

Connect to the PDB as a local user with SYSDBA system privilege.

ALTER PLUGGABLE DATABASE CLOSE;

ALTER DATABASE DATAFILE 12 OFFLINE;

RESTORE DATABASE;

RECOVER DATABASE;

ALTER DATABASE DATAFILE 12 ONLINE;

ALTER PLUGGABLE DATABASE OPEN;

Cloud Control can be used for Performing Complete Recovery of PDBs.

Cloud Control can be used for Performing Complete Recovery of tablespaces in a PDB.

Performing Complete Recovering of CDBs After Switching to a Copy

To switch a data file in a CDB, connect to the root and use the same steps that you would use for a non-CDB.
To switch a data file in a PDB, use one of the following techniques:
■Connect to the root and use the SWITCH … PLUGGABLE DATABASE or SWITCH DATAFILE command. This enables you to switch the data files for one or more PDBs.
■Connect to the PDB and use the SWITCH DATABASE or SWITCH DATAFILE command to switch data files in that PDB.