Wednesday, 25 March 2009

How does one backup and restore a database using RMAN?

The biggest advantage of RMAN is that it only backup used space in the database.

RMAN doesn't put tablespaces in backup mode, saving on redo generation overhead.

RMAN will re-read database blocks until it gets a consistent image of it.

Backup Example :

rman target sys/*** nocatalog

run {
allocate channel t1 type disk;
backup
format '/app/oracle/backup/%d_t%t_s%s_p%p'
(database);
release channel t1;
}

RMAN RESTORE Example:


rman target sys/*** nocatalog

run {
allocate channel t1 type disk;
# set until time 'Aug 07 2000 :51';
restore tablespace users;
recover tablespace users;
release channel t1;
}

The examples above are extremely simplistic and only useful for illustrating basic concepts. By default Oracle uses the database controlfiles to store information about backups. Normally one would rather setup a RMAN catalog database to store RMAN metadata in. Read the Oracle Backup and Recovery Guide before implementing any RMAN backups.

Note: RMAN cannot write image copies directly to tape. One needs to use a third-party media manager that integrates with RMAN to backup directly to tape. Alternatively one can backup to disk and then manually copy the backups to tape.

No comments:

Post a Comment