数据库恢复实例三:恢复spfile
数据库错误如下:
SQL> startup nomount;
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/10.2.0/db_1/dbs/inithdi26.ora'
1.分析
这个错误由初失参数文件丢失或引起的,恢复方法:通过备份,手工重建
本例通过RMAN来恢复spfile
2.启动数据库到nomount状态
在$ORACLE_BASE/admin/$ORACLE_SID/pfile/目录下有一参数
$ORACLE_BASE/admin/hdi26/pfile/
ls
init.ora.118200895840
SQL> startup nomount pfile=/u01/app/oracle/admin/hdi26/pfile/init.ora.118200895840
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size1220432 bytes
Variable Size486539440 bytes
Database Buffers1644167168 bytes
Redo Buffers15556608 bytes
3.恢复spfile
[oracle@HDI01 pfile]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Wed Dec 10 15:17:02 2008
Copyright (c) 1982, 2005, Oracle.All rights reserved.
connected to target database: hdi26 (not mounted)
RMAN> restore spfile from '/u09/orabackup/rman/controlfile/c-1504204985-20081210-01';
Starting restore at 10-DEC-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: autobackup found: /u09/orabackup/rman/controlfile/c-1504204985-20081210-01
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 10-DEC-08
4.重起数据库使用恢复的spfile启动数据库
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size1220432 bytes
Variable Size285212848 bytes
Database Buffers1845493760 bytes
Redo Buffers15556608 bytes
Database mounted.
Database opened.
5.创建pfile
create pfile from spfile;
注:手工重建:
1.从alter log重建,alter log中会记录数据库在启动时的所有非默认参数
2.直接使用$ORACLE_BASE/admin/hdi26/pfile/的初始参数