Database Reference
In-Depth Information
media recovery complete, elapsed time: 00:00:01
Finished recover at 22.09.2013 22:08
Statement processed
released channel: c1
The output above proves that existing tablespace recovery scripts should work more or less unmodified in
Pluggable Databases—but please test your scripts for your environment. You can also restore and recover PDB related
files from the CDB$ROOT, all you need to do is to add a prefix to the tablespace name. The exact same example just
shown looks as follows if you are connected to the root:
run {
allocate channel c1 device type disk;
sql 'PDB1' 'alter tablespace PDB1_TBS_2 offline';
restore tablespace pdb1:PDB1_TBS_2;
recover tablespace pdb1:PDB1_TBS_2;
sql 'PDB1' 'alter tablespace PDB1_TBS_2 online';
}
This will take the tablespace offline. Note the PDB1 prefix in the SQL command! The next command is to restore
the tablespace. Note how the PDB1 prefix is used to tell RMAN to which PDB the command is to be applied. The
recover command behaves identically. The last step is to take the tablespace online again.
Restoring to a different location
Sometimes it is necessary to restore parts of the database—either individual files or whole tablespaces—to a different
location on the file system. This could be due to planned maintenance such as the decommissioning of a tray in
the storage array, or media failure associated with a mount point. In either case, you can definitely restore to a new
location, and it is not difficult to do so. Assume for example that the datafile 11 of PDB “pdb1” needs to be restored to
disk group FASTDATA residing on a higher tier of storage, and it currently is stored in the generic +DATA disk group.
The commands to restore the file while connected to the PDB instead of the CDB$ROOT are shown in
this example:
run {
set newname for datafile 11 to '+fastdata';
alter database datafile 11 offline;
restore datafile 11;
switch datafile all;
recover datafile 11;
alter database datafile 11 online;
}
The little RMAN script “moved” the datafile to the new disk group.
RMAN> select name from v$datafile where file# = 11;
NAME
--------------------------------------------------------------------------------
+FASTDATA/CDB1/E6CDAD92377F667EE0436638A8C0DB6C/DATAFILE/example.293.826875289
The process is identical for non-OMF/non ASM data files. In such a case you could set the new name of the
datafile to the exact location where you want it to be restored.
 
Search WWH ::




Custom Search