Databases Reference
In-Depth Information
Recover While Database Is Open
For non-system and non-undo data files, you have the option of keeping the database open while performing the
recovery. When your database is open, you're required to take offline any data files you're attempting to restore
and recover.
$ rman target /
RMAN> alter database datafile 4 offline;
RMAN> restore datafile 4;
RMAN> recover datafile 4;
RMAN> alter database datafile 4 online;
If you're using Oracle Database 11 g or lower, you'll need to use the sql command combined with alter
database commands and quotes:
$ rman target /
RMAN> sql 'alter database datafile 4 offline';
RMAN> restore datafile 4;
RMAN> recover datafile 4;
RMAN> sql 'alter database datafile 4 online';
Instead of the file number, you can also specify the name of the data file that you want to restore and recover:
$ rman target /
RMAN> alter database datafile '/u01/dbfile/o12c/users01.dbf' offline;
RMAN> restore datafile '/u01/dbfile/o12c/users01.dbf';
RMAN> recover datafile '/u01/dbfile/o12c/users01.dbf';
RMAN> alter database datafile '/u01/dbfile/o12c/users01.dbf' online;
If you're using Oracle Database 11 g or lower, you'll have to do some quoting gymnastics to run the alter database
datafile statements:
$ rman target /
RMAN> sql "alter database datafile ''/u01/dbfile/o12c/users01.dbf'' offline";
RMAN> restore datafile '/u01/dbfile/o12c/users01.dbf';
RMAN> recover datafile '/u01/dbfile/o12c/users01.dbf';
RMAN> sql "alter database datafile ''/u01/dbfile/o12c/users01.dbf'' online";
When using the rman sql command, if there are single quote marks within the SQl statement, you are
required to use double quotes to enclose the entire SQl statement and then also use two single quote marks where you
would ordinarily use a single quote mark.
Note
How It Works
A data file-level restore and recovery works well when you want to specify which data files you want recovered. With
data file-level recoveries, you can use either the data file number or the data file name. For non-system and non-undo
data files, you have the option of restoring and recovering while the database is open. While the database is open, you
have to first take offline any data files being restored and recovered.
 
 
Search WWH ::




Custom Search