Lesson 8 | Perform database recovery with line command RMAN |
Objective | Use line command RMAN to recover a failed database. |
Perform Database Recovery with Line Command RMAN
Recovering from failure
Backing up the database is the easy part. The real challenge begins when the "ORA-01113 file needs recovery" message flashes on your console.
Fortunately, using RMAN for recovery is as simple as backing up in the first place.
Just as only a few commands are required to back up the database, it takes only a few commands to restore it:
RMAN> RUN {
2> ALLOCATE CHANNEL T1 TYPE 'SBT_TAPE';
3> RESTORE DATABASE;
4> RECOVER DATABASE;
5> RELEASE CHANNEL T1;
6> }
To restore the database to its present location
Start RMAN and connect to the target database and recovery catalog database. For example, enter:
% RMAN CATALOG RMAN/RMAN@BACKUP
RMAN> CONNECT TARGET RMAN/RMAN@PETS
If the database is open, shut it down, and then mount it:
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
After allocating the channels, restore the database:
RUN
{
ALLOCATE CHANNEL C1 TYPE DISK;
RESTORE DATABASE;
}
Once the database is restored, open the database.
The following simulation uses RMAN to recover a failed database.
Recovering Database Line Mode
The next lesson shows how to restore a tablespace, control file, and archived log files by using RMAN.