Recover Oracle using
an Offline Backup with RMAN
Before you can restore
your database using RMAN, the following needs to be properly in place (this
assumes a full system loss):
* The operating system
must be installed
* The Oracle software
must be installed
* The RMAN backup files
must be available
* You must create the
file systems that the database files will be restored to.
Once these
pieces are in place you can restore your database. In the event of a full
system loss you will need to replace:
* The SPFILE
* The Control
File
* The database
datafiles
If
the SPFILE or control file is intact, you will not need to replace that
component.
Restoring
the Oracle SPFILE
Restoring the
SPFILE is an automated process in many cases with RMAN. You simply need to configure
RMAN with the proper database DBID (which you should have recorded when you
created the database) and you can then restore the SPFILE from any auto backup.
To restore the
spfile, you still need to start the database, but you can do so with a minimal database
parameter file. All you need to do is start your database instance is set the
db_name parameter in a manual parameter file. Then you can start the instance
using the startup command with the pfile parameter as seen in this
example:
Startup nomount
pfile=c:\u01\app\oracle\product\12.1.0.2\database\initstand.ora
Once the
instance is started, you can start RMAN and restore the SPFILE as seen in this
example:
RMAN>restore spfile from
autobackup;
Restoring
the Oracle Control File
Restoring the control file is
much like restoring the SPFILE. Again, you simply need to configure RMAN with
the proper database DBID and you can then restore the control file from any
auto backup.
To restore the control file,
you still need to start the database, but you can do so with a minimal database
parameter file. All you need to do is start your database instance is set the
db_name parameter in a manual parameter file. Then you can start the instance
using the startup command with the pfile parameter as seen in this example:
Startup nomount pfile=c:\u01\app\oracle\product\12.1.0.2\database\initstand.ora
Once the instance is started,
you can start RMAN and restore the CONTROL FILE as seen in this example:
RMAN>restore controlfile from
autobackup;
Restoring
and Recovering the Database
Once you have recovered the
SPFILE and the control file, restoring the database can be pretty easy. Again,
many things can occur to make the process more complex, but assuming that you
have restored your RMAN backup sets in the same place, and that all of your
file systems are built correctly, and named the same as before, your restore
the database with the following command:
RMAN>recover database noredo;
If the online archived redo
logs are available, then change the command to the following:
RMAN>restore database;
Once the database is restored,
you can then recover the database. Simply use the RMAN recover database command
as seen here:
RMAN>recover database;
Once you have issued this
command, your database should be recovered to the point of the backup.
Recover your Database using
an Online Backup with RMAN
If you backed up your
ARCHIVELOG mode database with RMAN then you will be able to recover to the
point of the last available archived redo log (or online redo log if those are
still available). The cool thing is that the RMAN procedure is almost the same
regardless of if the backup was in ARCHIVELOG mode or NOARCHIVELOG mode.
First, follow the directions
above for restores of the SPFILE and the control file. Now, simply use the
restore database and recover database commands as seen here:
RMAN>restore database;
RMAN>recover database;
Again, Oracle will restore your
database. It will also automatically recover the archived redo logs for you, so
you don't have to worry about it.
No comments:
Post a Comment