丢失spfile的恢复
1、实验过程
[root@oracledbs]# pwd
/u01/app/oracle/product/11.2.0/db_1/dbs
[root@oracledbs]# ll
total9672
-rw-rw----1 oracle dba 1544 Mar 1 13:16 hc_DBUA0.dat
-rw-rw----1 oracle dba 1544 Mar 28 10:25hc_yyy.dat
-rw-r--r--1 oracle dba 2851 May 15 2009 init.ora
-rw-r-----1 oracle dba 24 Mar 1 13:25 lkYYY
-rw-r-----1 oracle dba 1536 Mar 26 12:00orapwyyy
-rw-r-----1 oracle dba 9879552 Mar 26 12:19 snapcf_yyy.f
-rw-r-----1 oracle dba 2560 Mar 28 10:25spfileyyy.ora
[root@oracledbs]# rm spfileyyy.ora
[root@oracledbs]# ll
total9668
-rw-rw----1 oracle dba 1544 Mar 1 13:16 hc_DBUA0.dat
-rw-rw----1 oracle dba 1544 Mar 28 10:25hc_yyy.dat
-rw-r--r--1 oracle dba 2851 May 15 2009 init.ora
-rw-r-----1 oracle dba 24 Mar 1 13:25 lkYYY
-rw-r-----1 oracle dba 1536 Mar 26 12:00orapwyyy
-rw-r-----1 oracle dba 9879552 Mar 26 12:19 snapcf_yyy.f
2、开始恢复
RMAN>restore spfile fromautobackup;
Startingrestore at 28-MAR-18
usingtarget database control file instead of recovery catalog
allocatedchannel: ORA_DISK_1
channelORA_DISK_1: SID=1145 device type=DISK
RMAN-00571:===========================================================
RMAN-00569:=============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571:===========================================================
RMAN-03002:failure of restore command at 03/28/2018 10:21:53
RMAN-06564:must use the TO clause when the instance is started with SPFILE
RMAN>shutdown immediate;
databaseclosed
databasedismounted
Oracleinstance shut down
RMAN>startup nomount;
connectedto target database (not started)
startupfailed: ORA-01078: failure in processing system parameters
LRM-00109:could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/inityyy.ora'
startingOracle instance without parameter file for retrieval of spfile #没有检索数据库的参数文件启动实例
Oracleinstance started
TotalSystem Global Area 158662656 bytes
FixedSize 2211448 bytes
VariableSize 92275080 bytes
DatabaseBuffers 58720256 bytes
RedoBuffers 5455872 bytes
RMAN>restore spfile fromautobackup;
Startingrestore at 28-MAR-18
allocatedchannel: ORA_DISK_1
channelORA_DISK_1: SID=96 device type=DISK
channelORA_DISK_1: looking for AUTOBACKUP on day: 20180328
channelORA_DISK_1: looking for AUTOBACKUP on day: 20180327
channelORA_DISK_1: looking for AUTOBACKUP on day: 20180326
channelORA_DISK_1: looking for AUTOBACKUP on day: 20180325
channelORA_DISK_1: looking for AUTOBACKUP on day: 20180324
channelORA_DISK_1: looking for AUTOBACKUP on day: 20180323
channelORA_DISK_1: looking for AUTOBACKUP on day: 20180322
channelORA_DISK_1: no AUTOBACKUP in 7 days found
RMAN-00571:===========================================================
RMAN-00569:=============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571:===========================================================
RMAN-03002:failure of restore command at 03/28/2018 10:22:54
RMAN-06172:no AUTOBACKUP found or specified handle is not a valid copy or piece
RMAN>restore spfile from'/file/backup/rman/controlfile_c-2086322433-20180326-09';
Startingrestore at 28-MAR-18
usingchannel ORA_DISK_1
channelORA_DISK_1: restoring spfile from AUTOBACKUP/file/backup/rman/controlfile_c-2086322433-20180326-09
channelORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finishedrestore at 28-MAR-18
3、启动数据库
RMAN>shutdown immediate
Oracleinstance shut down
RMAN>startup;
connectedto target database (not started)
Oracleinstance started
databasemounted
databaseopened
TotalSystem Global Area 2405122048 bytes
FixedSize 2215704 bytes
VariableSize 620757224 bytes
DatabaseBuffers 1761607680 bytes
RedoBuffers 20541440 bytes