Sunday, November 16, 2014

Simple Backup and Recovery using Oracle Reocovery Manager RMAN

First of all i wanted to know which instance i am connected.
select instance_name from v$instance






Instance name is ORCL

Then you need to connect to rman target (which is in a nocatalog mode) Inside control file it will store the back up details.

os> rman target /







Now you will list down  the current backup details.
rman >list backup summary;






determine which database files need backup under a specific retention policy
rman> report need backup;

show all configured parameter values
rman> show all;



Now backup the database

rman > backup database;



There it shows the backup location of controlfiles,spfile and datafiles.


shutdown the database
rman>shutdown immediate;






Now you need to delete the database files,control files,redo log files manually on the physical disk.

now exit from rman and connect again






you need to restore the datafiles,control files,spfiles

First of all you need to restore control files  from the backup

Since we have the spfile we can startup database to nomount mode
rman>startup nomount;

now you can restore the database using the backup.

First restore control file location
rman>'D:\Oracle\fast_recovery_area\ORCL\BACKUPSET\2014_11_16\O1_MF_NCSNF_TAG20141116T120250_B6JKBGCF_.bkp';


Now you can open database on mount mode

rman>alter database mount;



Now you can restore the datafiles.No need to specify the datafiles individually.
rman>restore database;


//still redo log files are not created.

now you need to recover  the database with archive logs
rman> recover database;


Now you need the database with RESETLOGS option
rman>alter database open resetlogs;