Customise Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.

No cookies to display.

Restore RAC Database from RMAN Backup Set

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
  • User AvatarKiran Dalvi
  • 18 Oct, 2022
  • 0 Comments
  • 4 Mins Read

Restore RAC Database from RMAN Backup Set

Restore RAC Database from RMAN Backup Set

First of all, make sure the clusterware is Up and Running.
1
2
[grid@prim~]$ crsctl check crs
[grid@prim~]$ crsctl status resource -t
Restore Cluster Database 1. Make a Directory in Disk Group
1
2
[grid@prim~]$ asmcmd mkdir +DATA/PRIM
[grid@prim~]$ asmcmd ls -l +DATA
Make sure that we have a backup set of the database.
1
[oracle@prim~]$ ll /backup
2. Detach Database from Clusterware Since we only use one node to do the entire recovery, so we have to detach the database from the clusterware in case we trigger automatic restart during maintenance time.
1
[oracle@prim~]$ srvctl disable database -d prim
3. Startup a Dummy Instance We need a dummy instance to restore SPFILE from a backup piece.
1
2
3
[oracle@prim~]$ rman target /
 
RMAN> startup nomount force;
4. Restore SPFILE to a Local Directory We did not restore SPFILE directly to the disk group. Instead, we restore SPFILE to a local directory, say /tmp. We will use the restored SPFILE to create a PFILE.
1
2
3
4
5
RMAN> restore spfile to '/tmp/spfilePRIM.ora' from '/backup/PRIM_968055037_08u52b7j_1_1';
Then shutdown the instance.
RMAN> shutdown immediate;
 
Oracle instance shut down
5. Create a PFILE for Later Startups We created PFILE from this SPFILE for later operations.
1
2
3
RMAN> create pfile='/tmp/initprim.ora' from spfile='/tmp/spfileprim.ora';
 
Statement processed
6. Startup Database to Nomount by PFILE Then startup the database to nomount state by the PFILE.
1
RMAN> startup nomount pfile='/tmp/initprim.ora';
7. Restore Controlfile
1
2
3
4
5
RMAN> restore controlfile from '/backup/PRIM_968055037_08u52b7j_1_1';
Then we shutdown the instance.
RMAN> shutdown immediate;
 
Oracle instance shut down
8. Modify PFILE Since restored controlfile name was different from the original one under OMF’s instruction, we had to modify PFILE to align with the current controlfile name.
1
2
3
[oracle@prim~]$ vi /tmp/initprim.ora
...
*.control_files='+DATA/PRIM/CONTROLFILE/current.276.1012058301'
9. Startup Database to Mount by PFILE For restoring SPFILE correctly, we have to mount the controlfile to let ASM know the database name of current instance.
1
RMAN> startup mount pfile='/tmp/initprim.ora';
10. Restore SPFILE to ASM Diskgroup We have to know the location of SPFILE before we create it.
1
2
[oracle@prim~]$ cat $ORACLE_HOME/dbs/init$ORACLE_SID.ora
SPFILE='+DATA/PRIM/spfilePRIM.ora'
This is a pointer of SPFILE, the technique is adopted by RAC. Now we can create SPFILE from the modified PFILE.
1
2
3
RMAN> create spfile='+DATA/PRIM/spfileprim.ora' from pfile='/tmp/initprim.ora';
 
Statement processed
We have created SPFILE from our modified PFILE. Of course, you can also restore SPFILE from the above backup piece, but subsequently, you have to change the location of control files by ALTER SYSTEM SET CONTROL_FILES under NOMOUNT. Why should we do so many steps above before restoring SPFILE? Why don’t we just restore SPFILE in the first place when the dummy instance is up? This is because we don’t want SPFILE to be restore to +DATA/DB_UNKNOWN directory, even though it will be working find after instance restarted. Check the physical location of SPFILE.
1
[grid@prim~]$ asmcmd ls -l +DATA/PRIM
11. Restart Database to Mount We have both SPFILE and controlfiles restored, let’s see whether they can work together as usual.
1
2
3
4
5
6
RMAN> shutdown immediate;
 
database dismounted
Oracle instance shut down
 
RMAN> startup mount;
Check SPFILE of current instance.
1
SQL> show parameter spfile;
12. Catalog the Backup Set Before we can use the backup set to restore the database, controlfiles need to know their existence.
1
RMAN> catalog start with '/backup/';
13. Restore Data Files Use the cataloged backup set to restore the database, specifically, data files.
1
RMAN> restore database;
14. Recover Database
1
RMAN> recover database;
The error messages are just some notifications, you can ignore them. 15. Open Database Since this is a point-in-time recovery and we don’t have any redo logs, so we have to open the database with reset redo logs. In this step, the log sequence will be reset and redo logs are created.
1
2
3
4
5
6
7
8
9
RMAN> alter database open resetlogs;
 
Statement processed
 
RMAN> select name, open_mode from v$database;
 
NAME OPEN_MODE
--------- --------------------
PRIM READ WRITE
Then we shutdown the instance.
1
RMAN> shutdown immediate;
16. Create a New Password File We created a new password file for the cluster database.
1
[oracle@prim~]$ orapwd file='+DATA' dbuniquename='prim' password=oracle
The configuration of the cluster database reflected the new password file.
1
[oracle@prim~]$ srvctl config database -d PRIM
Check the physical location of the new password file.
1
[grid@prim~]$ asmcmd ls -l +DATA/PRIM/PASSWORD
ADD DATABASE TO CLUSTER and Add rac Instanses
1
2
3
4
5
srvctl add database -d prim -o $ORACLE_HOME
srvctl add instance -d prim -i prim1 -n node1
srvctl add instance -d prim -i prim2 -n node2
srvctl config database -d prim -a
srvctl modify database -d prim -spfile +DATA/PRIM/spfileprim.ora