Get in touch: [email protected]

Restoring a Container Database and Its Pluggable Databases – RMAN Backups and Reporting

You saw the commands already to recover the database, which will include all of the data files for the root and pluggables.

Also, the examples showed how to validate just the pluggable databases with RESTORE DATABASE and RECOVER DATABASE.

This will restore and recover the root container, seed, and all associated pluggable databases.

$ rman target / RMAN> startup mount;

RMAN> restore database; RMAN> recover database; RMAN> alter database open;

RMAN> alter pluggable database all open;

Restoring and Recovering Root Container Data Files

If just data files associated with the root container have been damaged, then you can restore and recover at the root level. In this example, the root container’s system data file is being restored, so the database must not be open.

The following commands instruct RMAN to restore only the data files associated with the root container database, via the keyword root:

$ rman target / RMAN> startup mount;

RMAN> restore database root; RMAN> recover database root; RMAN> alter database open;

In the prior code, the restore database root command instructs RMAN to restore only data files associated with the root container database. After the container database is opened, you must open any associated pluggable databases.

You can do so from the root container, as shown here:

RMAN> alter pluggable database all open;

You can check the status of your pluggable databases via this query:

SQL> select name, open_mode from v$pdbs;

Restoring and Recovering a Pluggable Database You have two options for restoring and recovering a pluggable database.

•     Connect as the container root user, and specify the pluggable database to be restored and recovered.

•     Connect directly to the pluggable database as a privileged pluggable-level user, and issue RESTORE and RECOVER commands.

This first example connects to the root container and restores and recovers the data files associated with the salespdb pluggable database.

For this to work, the pluggable database must not be open (because the pluggable database’s system data files are also being restored and recovered):

$ rman target /

RMAN> alter pluggable database salespdb close; RMAN> restore pluggable database salespdb; RMAN> recover pluggable database salespdb; RMAN> alter pluggable database salespdb open;

You can also connect directly to a pluggable database and perform restore and recovery operations.

When connected directly to the pluggable database, the user only has access to the data files associated with the pluggable database:

$ rman target sys/Pa$$word1@salespdb RMAN> shutdown immediate;

RMAN> restore database; RMAN> recover database; RMAN> alter database open;

The prior code affects only data files associated with the pluggable database to which you are connected. The pluggable database needs to be closed for this to work.

However, the root container database can be open or mounted. Also, you must use a backup that was taken while connected to the pluggable database as a privileged user.

The privileged pluggable database user cannot access backups of data files initiated by the root container database privileged user.