缺少初始化文件,数据库是无法启动的。如果通过RMAN备份了初始化参数,那么可以通过RMAN对初始化参数进行恢复。
这篇文章简单介绍CATALOG方式下初始化参数的恢复问题。
初始化参数的丢失和损坏,并不会造成太严重的问题,即使是最坏的情况,导致无法进行恢复,也是可以通过手工编辑一个新的PFILE文件,来启动实例的。
而且,在数据库的alert文件中包含了每次数据库启动使用的所有非默认值初始化参数,因此重新编写一个初始化参数并不困难。
不过,既然对SPFILE进行了备份,那么完全可以采用恢复的方式来还原SPFILE。
对于CATALOG方式,SPFILE的恢复相对简单很多。不过Oracle文档上对于SPFILE的恢复的描述有些小问题:SET DBID这个步骤是不能省略的,否则会报错。
$ rman target / catalog "rman/rman@testcen"
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database (not started)
connected to recovery catalog database
RMAN> startup force nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/opt/ora9/product/9.2/dbs/inittestdata.ora'
trying to start the Oracle instance without parameter files ...
Oracle instance started
Total System Global Area 97588504 bytes
Fixed Size 451864 bytes
Variable Size 46137344 bytes
Database Buffers 50331648 bytes
Redo Buffers 667648 bytes
RMAN> restore spfile;
Starting restore at 27-6月 -07
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/27/2007 10:36:46
RMAN-12010: automatic channel allocation initialization failed
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog
正确的方式如下:
$ rman target / catalog "rman/rman@testcen"
IXDBA.NET技术社区Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: DUMMY (not mounted)
connected to recovery catalog database
RMAN> set dbid 2270762593;
executing command: SET DBID
RMAN> startup force nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/opt/ora9/product/9.2/dbs/inittestdata.ora'
trying to start the Oracle instance without parameter files ...
Oracle instance started
Total System Global Area 97588504 bytes
Fixed Size 451864 bytes
Variable Size 46137344 bytes
Database Buffers 50331648 bytes
Redo Buffers 667648 bytes
RMAN> restore spfile;
Starting restore at 27-6月 -07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=9 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=10 devtype=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: sid=11 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring SPFILE
output filename=/opt/ora9/product/9.2/dbs/spfiletestdata.ora