Restore the SPFILE from the controlfile Autobackup

If you have lost the SPFILE (server parameter file), and your Database abnormally shutdown then you will try to startup your Database but you got an error regarding spfile not found. You can restore spfile from autobackup using RMAN.

How to Restore SPFILE from autobackup?

NOTE:- Database must be in archivelog mode and must be configured Controlfile Autobackup on, then take a full Database backup using RMAN.

How to change database in archivelog mode?

To open database in archivelog mode follow me step by step.

$sqlplus / as sysdba

SQL> startup mount; 
SQL> alter database archivelog; 
SQL> alter database open; 

How to configure autobackup?

Connect with RMAN and configure autobackup using following commands.

$rman  target/ 
RMAN> show all; 
RMAN> configure controlfile autobackup on; 

How to take Database full backup using RMAN?

Using below command we can take full database backup.

RMAN> backup database plus archivelog; 

After finishing Backup, it’ll show you the backup location note down it and shutdown Database then run STARTUP command, it’ll show you an error message regarding SPFILE, before recovery you have to need dbid, you can check your dbid using v$database, then connect to RMAN and recover it using below command.

SQL>select dbid from v$database;

     DBID
 ----------
 355418079

Now connect to RMAN and set database id.

$rman target/
RMAN>set dbid=355418079; 
RMAN>startup force nomount; 

How to restore spfile from autobackup?

RMAN> restore spfile from  '/u01/DB11G/backupset/2015_07_24/o1_mf_nnndf_TAG20150724T144541_bv40kyfj_.bkp'; 

After recovery of spfile, now you can open your Database.

RMAN>startup foce;

Read – Use RMAN in NOARCHIVE

Connect with me on:

Instagram: https://www.instagram.com/shripaldba
Linkedin: 
https://www.linkedin.com/in/shripal-singh
Twitter: 
https://twitter.com/ocptechnology
Facebook: 
https://www.facebook.com/ocptechnology
YouTube: 
https://www.youtube.com/ocptechnology

Leave a Comment

%d bloggers like this: