TheDataGirl

A little blog about big data and other things
https://www.google.com.mt/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&cad=rja&uact=8&ved=2ahUKEwjwnq_Ako7dAhUOKewKHeACB2wQjRx6BAgBEAU&url=https%3A%2F%2Fwww.dbarj.com.br%2Fen%2F2016%2F01%2Fchange-rman-configuration-using-dbms_backup_restore%2F&psig=AOvVaw2A_QSPnvQF9C8tOPNGVP6C&ust=1535490631793367

Restoring using RMAN

RMAN is a Recovery Manager tool used for restorations and backups. It has gained its popularity due to the simplicity of use.

 

In this article we will not get into much detail of what RMAN is and how it works. We’ll leave that for a later topic. Instead, we will devote this article to defining the process required in order to perform a RMAN restoration from a previously taken backup.

 

  1. Check if the database is asm

                      ps -ef | grep pmon

 

  1. If asm, drop the database

                      sqlplus / as sysdba

                      startup mount exclusive restrict;

                      drop database;

 

  1. Change SID

                     Export ORACLE_SID=XXX

 

  1. Check which restoration backup needs to be restored (basically the date and time and source area)

 

  1. Edit the rman script with the date and the time. Ensure that the correct area is selected. Go to the directory which contains your rman scripts to open and edit

                      cd XXXXXX

                      vi restore_from_backup.rman

 

  1. Check the rman and sh scripts

If the archive logs have been backed up, we can restore and recover at the same time by including the following commands after restoring the database and control files

                     alter database mount;

                     recover database delete;

 

  1. If the area is not ASM, you will need to manually remove the control files, redo files, index files and data files. The database will need to be in nomount state (since we will be removing the control file)

 

a) First, find the location of these files

                    sqlplus / as sysdba

                    select * from v$datafile

                    select * from v$controlfile

                    select * from v$redolog

                    select * from v$tempfile

b) Shutdown database

                   shutdown immediate;

c) Start up without mount

                   startup nomount;

                   exit;

d) Go to directories and remove files

                   pwd

                   cd ../oradata/XXXX

                   pwd

                   ls -lrt

Go to each directory

                   cd XXXXXXX

                   rm *

 

  1. Execute restore script with no hangups

                   nohup ./restore_from_backup.sh &

 

  1. Tail the log file onto the screen

                   tail -f restore_from_backup.log

 

  1. When log starts displaying read/writes

a) Open new session

b) Log in

c) Go into nsrwatch

                   nsrwatch

d) Search for ‘starting read from … ‘

 

  1. When restore is finished, if it is an older backup, please do the following

a) Open resetlogs

                   alter database open resetlogs;

            b) Shutdown database

                   shutdown immediate;

c) Start up with mount (we need the control file)

                   startup mount;

d) Set to no archive mode (if not production only)

                   alter database noarchivelog;

e) Open database

                   alter database open;

 

And, you’re done!

Leave a Reply

Your email address will not be published. Required fields are marked *