spfile丢失的恢复

报错信息:
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl.ora'

错误显示找不到参数文件,数据库无法nomount。下面我们使用rman进行恢复。
[oracle@localhost ~]$ rman target / nocatalog


Recovery Manager: Release 11.2.0.1.0 - Production on Sat Aug 16 03:32:25 2014


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


connected to target database (not started)
RMAN> startup nomount;


startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl.ora'


starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started


Total System Global Area     159019008 bytes


Fixed Size                     1335192 bytes
Variable Size                 75497576 bytes
Database Buffers              79691776 bytes
Redo Buffers                   2494464 bytes
注意到这里存在着一个特殊的情况:当我们使用rman的时候,oracle允许在没有参数文件的情况下启动一个实例,
数据库的db_name会被缺省的命名为DUMMY。
RMAN> restore spfile from autobackup;


Starting restore at 16-AUG-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/16/2014 03:37:55
RMAN-06495: must explicitly specify DBID with SET DBID command

这里出现错误,rman提示我们必须使用set dbid命令指定数据库的dbid。
RMAN> set dbid=1383336109


executing command: SET DBID


RMAN> restore spfile from autobackup;


Starting restore at 16-AUG-14
using channel ORA_DISK_1


channel ORA_DISK_1: looking for AUTOBACKUP on day: 20140816
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20140815
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20140814
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20140813
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20140812
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20140811
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20140810
channel ORA_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 08/16/2014 03:39:24
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece

这里我们可以看到错误提示说找不到有效的自动备份。于是到相应的目录下去找,发现的确存在有效的自动备份。而且数据库在7天之内有发生自动备份,于是我们就直接在rman中指定最新的自动备份的路径来进行恢复。
RMAN> restore spfile from '/u01/app/oracle/flash_recovery_area/ORCL/autobackup/2014_08_16
2> /o1_mf_s_855716497_9yyc01qb_.bkp
3> ';


Starting restore at 16-AUG-14
using channel ORA_DISK_1


channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2014_08_16/o1_mf_s_855716497_9yyc01qb_.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 16-AUG-14

尝试重新打开数据库:
SQL> startup
ORACLE instance started.


Total System Global Area  849530880 bytes
Fixed Size                  1339824 bytes
Variable Size             515903056 bytes
Database Buffers          327155712 bytes
Redo Buffers                5132288 bytes
Database mounted.
Database opened.





 
 


请使用浏览器的分享功能分享到微信等