Get in touch: [email protected]

Restoring and Recovering Tablespaces – RMAN Backups and Reporting

Sometimes you will have a media failure that is localized to a particular tablespace or set of tablespaces. In this situation, it is appropriate to restore and recover at the tablespace level of granularity.

The RMAN RESTORE TABLESPACE and RECOVER TABLESPACE commands will restore and recover all data files associated with the specified tablespace(s).

Restoring Tablespaces While the Database Is Open

This has been my experience that I need a data file, a tablespace, or even a block of data restored because of a failure. In that case, you do not need to restore the entire database, and the rest of the database can be up and running.

If your database is open, then you must take offline the tablespace you want to restore and recover.

You can do this for any tablespace except SYSTEM and UNDO. This example restores and recovers the USERS tablespace while the database is open:

$ rman target /

RMAN> alter tablespace users offline immediate; RMAN> restore tablespace users;

RMAN> recover tablespace users; RMAN> alter tablespace users online;

After the tablespace is brought online, you should see a message such as this:

Statement processed

Restoring Tablespaces While the Database Is in Mount Mode

Usually when performing a restore and recovery, DBAs will shut down the database and restart it in mount mode in preparation for performing the recovery.

Placing a database in mount mode ensures that no users are connecting to the database and that no transactions are transpiring.

Also, if you are restoring and recovering the SYSTEM tablespace, then you must start the database in mount mode.

Oracle does not allow for restoring and recovering the SYSTEM tablespace data files while the database is open.

This next example restores the SYSTEM tablespace while the database is in mount mode:

$ rman target /

RMAN> shutdown immediate; RMAN> startup mount;

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

If successful, the last message you should see is this:

Statement processed

Notice that you can do startup and shutdown commands in RMAN. This is useful for the recovery process and not having to switch tools and stay in one tool.