Restore all versions of the spfiles


15.09.2014
by Kamil Stawiarski

A few months ago I showed how to restore a controlfile, when you have no idea in which backupset is the newest file

https://blog.ora-600.pl/2014/04/26/oracle-myth-you-need-dbid-to-restore-the-controlfile/

On last training one of my students asked me, how to locate an appropriate spfile backup after using this trick (the restored database has a different DBID).

Well, you can just use a simple AWK script to generate RMAN commands:

[oracle@krol-julian ~]$ ls /u01/backup1/10092014/ | awk -v c=\' '{print "restore spfile to " c"/tmp/spfiles/spfile"NR c " from "c"/u01/backup1/10092014/"$0c";"}' >> seach_spfile.sh
[oracle@krol-julian ~]$ cat seach_spfile.sh
#!/bin/bash

rman target / << !

restore spfile to '/tmp/spfiles/spfile1' from '/u01/backup1/10092014/0kpi5b0n_1_1';
restore spfile to '/tmp/spfiles/spfile2' from '/u01/backup1/10092014/0lpi5b0n_1_1';
restore spfile to '/tmp/spfiles/spfile3' from '/u01/backup1/10092014/0mpi5b0n_1_1';
restore spfile to '/tmp/spfiles/spfile4' from '/u01/backup1/10092014/0npi5b0n_1_1';
restore spfile to '/tmp/spfiles/spfile5' from '/u01/backup1/10092014/0opi5b0n_1_1';
restore spfile to '/tmp/spfiles/spfile6' from '/u01/backup1/10092014/0ppi5b0n_1_1';
restore spfile to '/tmp/spfiles/spfile7' from '/u01/backup1/10092014/0qpi5b0o_1_1';
restore spfile to '/tmp/spfiles/spfile8' from '/u01/backup1/10092014/0rpi5b0p_1_1';
restore spfile to '/tmp/spfiles/spfile9' from '/u01/backup1/10092014/0spi5b19_1_1';
restore spfile to '/tmp/spfiles/spfile10' from '/u01/backup1/10092014/0tpi5b1b_1_1';
restore spfile to '/tmp/spfiles/spfile11' from '/u01/backup1/10092014/0upi5b1d_1_1';

!

And remember: to have backup and to be able to restore from it: two different things 🙂


Contact us

Database Whisperers sp. z o. o. sp. k.
al. Jerozolimskie 200, 3rd floor, room 342
02-486 Warszawa
NIP: 5272744987
REGON:362524978
+48 508 943 051
+48 661 966 009
info@ora-600.pl

Newsletter Sign up to be updated