Database Reference
In-Depth Information
Some data file and tablespace recoveries require that the database be in MOUNT mode.
If you have lost the
SYSTEM
tablespace or the active
UNDO
tablespace (or an inactive tablespace
that contained transactions when the database was shut down), then your recovery will have
to be done with the database mounted.
The best recoveries (if there is really any kind of recovery that is considered good) are
those that your users know nothing about. If the data file or tablespace that was lost was not
the
SYSTEM
or active
UNDO
tablespace, then you can recover that data file or tablespace while
the rest of the database is still online. Thus, unless the users need access to the tablespace that
is being restored, they will never know that you were in the throes of some form of recovery.
In the following sections, we will address these two kinds of data file and tablespace
recoveries. First, we will address recovery of a data file or tablespace when the
SYSTEM
or
active
UNDO
tablespace is down and the database is not open. We will then address data file
and tablespace recoveries when the database is open and running.
Recovering Critical Database Data Files and/or Tablespaces
with the Database Down
If the
SYSTEM
or the active
UNDO
tablespace, or data files associated with those tablespaces, are
lost, then you will have to recover with the database shut down. In fact, if data files associated
with these tablespaces are lost, it's likely that the database will have crashed anyway. You can
use the
RESTORE DATAFILE
or
RESTORE TABLESPACE
RMAN command to restore the lost data
files or tablespaces quickly, in turn getting the database recovered as quickly as possible.
To restore a database data file or tablespace with the database shut down, follow
these steps.
1.
If the database is not already shut down, try to force a checkpoint and then shut down
the database as normally as possible.
It is possible that when you force the checkpoint, the database will crash.
2.
If you have lost your control file or spfile, you will need to reference the section
“Other Basic Recovery Topics,” which appears later in this chapter. To start any
RMAN recovery, you must have a control file and an spfile or parameter file.
3.
Mount your database with the
STARTUP MOUNT
command.
4.
You will use the RMAN
RESTORE
command to restore the data files or tablespaces.
If you have lost all or most of the data files related to a given tablespace, then issue
the RMAN
RESTORE TABLESPACE
command. If you have lost one or just a few data
files, use the
RESTORE DATAFILE
command. Once the restore is complete, you will be
returned to the RMAN prompt.
5.
You now need to recover the database with the RMAN
RECOVER
command. This will
apply any incremental backups and any archived redo logs to the data files being restored.
If you used the
RESTORE TABLESPACE
command, recover the tablespace with the
RECOVER
TABLESPACE
command. If you used the
RESTORE DATAFILE
command, use the
RECOVER
DATAFILE
command to start recovery. Once recovery is complete, you will be returned to
the RMAN prompt.
6.
Open the database with the
ALTER DATABASE OPEN
command. If you restored your control
file, you will need to use the
ALTER DATABASE OPEN RESETLOGS
command.
Search WWH ::
Custom Search