RMAN will restore read-only tablespaces along with the rest of the database when you issue a RESTORE DATDABASE command. For example, the following command will restore all data files (including those in read-only mode):
RMAN> restore database;
If you are using a backup that was created after the read-only tablespace was placed in read-only mode, then no recovery is necessary for the read-only data files. In this situation, no redo has been generated for the read-only tablespace since it was backed up.
Restoring Temporary Tablespaces
You do not have to restore or re-create missing locally managed temporary tablespace temp files. When you open your database for use, Oracle automatically detects and re-creates locally managed temporary tablespace temp files.
When Oracle automatically re-creates a temporary tablespace, it will log a message to your target database alert.log such as this:
Re-creating tempfile <your temporary tablespace filename>
If, for any reason, your temporary tablespace becomes unavailable, you can also re-create it yourself. Because there are never any permanent objects in temporary tablespaces, you can simply re-create them as needed.
Here is an example of how to create a locally managed temporary tablespace:
SQL> CREATE TEMPORARY TABLESPACE temp TEMPFILE;
If your temporary tablespace exists but the temporary data files are missing, you can just add them, as shown here:
SQL> alter tablespace temp add tempfile;
Restoring and Recovering Data Files
A data file–level restore and recovery works well when a media failure is confined to a small set of data files.
With data file–level recoveries, you can instruct RMAN to restore and recover either with a data filename or with a data file number.
For data files not associated with the SYSTEM or UNDO tablespaces, you have the option of restoring and recovering while the database remains open.
While the database is open, however, you must first take offline any data files being restored and recovered.
Recovering data files works in the container and pluggable database level.
Restoring and Recovering Data Files While the Database Is Open
Use the RESTORE DATAFILE and RECOVER DATAFILE commands to restore and recover at the data file level.
When your database is open, you are required to take offline any data files that you are attempting to restore and recover.
This example restores and recovers data files while the database is open:
RMAN> alter database datafile 4, 5 offline; RMAN> restore datafile 4, 5;
RMAN> recover datafile 4, 5;
RMAN> alter database datafile 4, 5 online;
Use the RMAN REPORT SCHEMA command to list data filenames and file numbers. You can also query the NAME and FILE# columns of V$DATAFILE to take names and numbers.
You can also specify the name of the data file you want to restore and recover; for example,
RMAN> alter database datafile ‘/u01/dbfile/db23c/users01.dbf’ offline; RMAN> restore datafile ‘/u01/dbfile/db23c/users01.dbf’;
RMAN> recover datafile ‘/u01/dbfile/db23c/users01.dbf’;
RMAN> alter database datafile ‘/u01/dbfile/db23c/users01.dbf’ online;