Backup and recovery with RMAN |
Just a few examples or use of RMAN utility. Be aware that RMAN syntax
is version dependent, the examples below work for
Oracle 10g and 11g.
Database ad-hoc backup
In this example we are backing up a
database without RMAN repository.
First we check the current settings the we launch a backup to disk. Your
database must be in archivelog
mode to use the following example.
oracle@host> rman target
/
RMAN> show all;
RMAN> run {
allocate channel ch1 type disk;
BACKUP CURRENT CONTROLFILE;
release channel ch1;
}
RMAN> run {
allocate channel ch1 type disk;
allocate channel ch2 type disk;
allocate channel ch3 type disk;
allocate channel ch4 type disk;
backup database;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
}
Restore a database from disk
1) We make sure the database can start
in nomount:
oracle@host> sqlplus /
as sysdba
SQL> startup
nomount
ORACLE instance started.
SQL> exit;
2) Then we recover control file first
then the database with RMAN:
oracle@host> rman
target /
RMAN> run {
restore controlfile
from autobackup;
}
RMAN> run {
allocate channel ch1 type disk;
allocate channel ch2 type disk;
allocate channel ch3 type disk;
allocate channel ch4 type disk;
restore database;
recover database;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
}