Wednesday , May 29 2024

How To Restore RAC Database From rman backup


When a database completely crashes, you need to do is to setup from scratch and return from backup.
If you have a Rman backup and archive log backups, and if you can access redo log files, you can return to the last moment.

If you can recover the redologs, you can do a complete recovery. Otherwise it is incomplete recovery. This also means there is data loss. Because all processes are not recovered.

First, we will install Oracle RDBMS and Grid infrastructure. If the ASM intance is accessible, the disk group is ready and the Oracle binary is already installed, we can start installation.

Let us assume that the database we will create is 2-node rac and the name ORCL. Suppose the DBID of our previous database is 1039438773. You can learn DBID information by connecting to rman.  This information is also available in v$database view. Suppose we have already learned DBID information in some way. Even if you haven’t, you can find this information in old backup logs.

The first process is to create the necessary directories in ASM disk groups.


The directory specified by the audit_file_dest parameter in the file system must be created on all nodes.


The next step is to create our pfile file or copy it from the backup to the corresponding directory ($ ORACLE_HOME / dbs). If you have Autobackup, you can also return your spfile file from autobackup.


If you do not have a backup, you can create a pfile as below and register it with the name initORCL1.ora (init{SID}.ora).


If the disk group we want to restore the database is different from the disk group where the old database is located, the following lines must be in the pfile.


We start the instance with pfile which we have created or restored.

We set variables before. You can add variables to /home/oracle/.bash_profile.

Or you can add the following line to /etc/oratab and set it with oraenv.

/etc/oratab content:


After adding this line, we can set all variables with oraaenv.


Now we can run sqlplus.


Let’s start Instance from the pfile file we created.


Then, we restore the control file with rman.


Let’s add the control file files to the pfile file that we created and restart the instance.

The row of the control file in the new pfile:


After the change, close the instance and reopen it as above.

If the directory in which we copy the backups to restore is different from the paths in the control file, it is necessary to perform catalog operation from rman while in mount mode.

Catalog operation with rman in mount mode:


With the command below, we make sure that the backups in the backup_files file are scanned and written to the control file.(this is catalog operation)


While our database is in nomount mode, we start the restore and recover operations with the following script. With the “set until time” command, we are restoring to the point we specified. If you do not specify it, it will try to restore it until the last moment.

Create a file named with the following content and give the necessary permissions(755).

We will run this file as follows.


If a different disk group is used, the names of the datafile must be changed and switch database operation is required before recover. The “set newname” command must be run for all datafiles. In this case, should be as follows.


If the disk group name is the same as before, the content of the file should be as follows.


When the processes are finished, the database and archive logs will be restored and recover will be done. After that, redo logs must also be processed.

We are connecting with sql plus for processing redo logs.

Because the redo logs that are used for all instances in RAC databases are connected, it will request the redologs that are needed to perform complete recovery when you run the following command.

After the line specified by “Specify log:”, you must specify the corresponding redo log. The “Log applied” result is returned when all the required redo logs are recovered.

You can find the entire script below.


So we have completed a complete recovery. In this case, we can open our database directly.


Otherwise we need to open it by specifying resetlogs.


Since our database has been opened, we can begin operations after restore.

First, create the spfile from the pfile:


Change the contents of the pfile (initORCL1.ora) under the $ORACLE_HOME/dbs directory as follows:


Set a password for the SYS user:


Create Orapw file:


If necessary, add new members to the redo log groups:


If you have not set the local_listener and remote_listener parameters, set it:

We created this information for all nodes when creating pfile.


Let’s add the new database and instances to CRS:


After copying the necessary files to the second node and creating a second undo tablespace, we can start instance on that node.

Files to copy:


The creation of the undo tablespace for the second node:


Creating a redo log group for the second node and adding a new member:

The size should be the same as that created for the other instance. Group numbers must be different from those created for the other instance.


At this stage, we can close the database and open it with srvctl in all instances.

Now, our RAC database is open and runs on 2 nodes.


About dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

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