• Arun Kumar

RMAN DB Full Backup & Recovery

In this article we will be looking at RMAN incremental backup & how to perform database recovery using incremental backup.


Take RMAN DB FULL Backup


Connect to the target DB and catalog. Take DB full backup

RMAN> backup database plus archivelog;

Once backup is completed, check backup tag via below command

RMAN> list backup of database summary;

Create User and Table

SQL> create user mgr2 identified by mgr2;
SQL> grant connect, resource, create session to mgr2;
SQL> conn mgr2/mgr2
SQL> create table test(serial number(2),name varchar2(5));
SQL> insert into test values(1,'one');
SQL> insert into test values(2,'Two');
SQL> insert into test values(3,'Three');
SQL> insert into test values(4,'Four');
SQL> commit;


Simulate Failure


Get the location of spfile, datafile & control file

SQL> show parameter spfile;
SQL> select name from v$controlfile;
SQL> select name from v$datafile;

Delete all the spfile, datafiles & Control files from server

rm -rf <DF locations>
rm -rf <control file locations> 
rm -rf <spfile location>


Start Database Recovery


Kill the DB instance, if running. You can do shut abort or kill pmon at OS level

Connect to RMAN and issue below command

RMAN> STARTUP FORCE NOMOUNT;
RMAN> Restore spfile from autobackup;

RMAN> STARTUP FORCE NOMOUNT;
RMAN> Restore controlfile from autobackup;
RMAN> sql 'alter database mount';

RMAN> Restore database from tag TAG20160618T204340;
RMAN> Recover database;
RMAN> sql 'alter database open RESETLOGS';

In case AUTOBACKUP is OFF, then Restore SPFILE & Control File using below

RMAN> list backup of spfile summary;
RMAN> list backup tag <give-latest-tag>;
RMAN> Restore spfile from tag '<give-latest-tag>';

RMAN> list backup of controlfile summary;
RMAN> list backup tag <give-latest-tag>;
RMAN> Restore controlfile from tag '<give-latest-tag>';


DB Recovery With Manual Channels


You can allocate manual channels and define one RMAN run block to perform complete database recovery

  • Fast recovery

  • Un-monitored recovery

RMAN> startup force nomount;
run{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
restore spfile from tag TAG20160618T205807;
startup force nomount;
restore controlfile from autobackup;
sql 'alter database mount';
restore database from tag TAG20160618T205739;
recover database;
sql 'alter database open RESETLOGS';
release channel ch1;
release channel ch2;
}

2,037 views

Recent Posts

See All