探索ORACLE之RMAN_03非一致性备份(六)
2, 2005, Oracle. All rights reserved.
Connected to anidle instance.
SQL> startup
ORA-01078:failure in processing system parameters
LRM-00109: couldnot open parameter file '/DBSoft/product/10.2.0/db_1/dbs/initWWL.ora'
SQL>
3、因为数据库没有参数文件,起不来,只能能启动到nomount状态
[oracle@wwldb dbs]$ rman target /
RecoveryManager: Release 10.2.0.1.0 - Production on Wed May 23 17:06:32 2012
Copyright (c)1982, 2005, Oracle. All rights reserved.
connected totarget database (not started)
RMAN> startup force nomount;
startup failed:ORA-01078: failure in processing system parameters
LRM-00109: couldnot open parameter file '/DBSoft/product/10.2.0/db_1/dbs/initWWL.ora'
starting Oracleinstance without parameter file for retrival of spfile
Oracle instancestarted
Total System GlobalArea 159383552 bytes
Fixed Size 1218244 bytes
VariableSize 58722620 bytes
DatabaseBuffers 92274688 bytes
RedoBuffers 7168000 bytes
RMAN>
4、开始恢复参数文件,只有恢复了参数文件和控制文件数据库才能到mount状态来恢复数据文件:
RMAN> restorespfile from autobackup;
Starting restoreat 23-MAY-12
using targetdatabase control file instead of recovery catalog
allocatedchannel: ORA_DISK_1 www.2cto.com
channelORA_DISK_1: sid=36 devtype=DISK
RMAN-00571:===========================================================
RMAN-00569:=============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571:===========================================================
RMAN-03002:failure of restore command at 05/23/2012 17:08:42
RMAN>
注意:这里有问题了,spfile无法恢复,必须指定DBID。我记得在每次登录到rman的时候都会显示一个数据库的DBID,但是为什么这里要我们指定DBID呢???原因很简单,因为我们登录RMAN的时候,数据库已经宕机了,而且参数文件,控制文件,数据文件都没有了,它到哪里去找DBID;所以需要我们手动来指定,问题是现在既然登录的时候不显示,我们也不知道在哪里呀,如下:
[oracle@wwldb dbs]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on WedMay 23 17:06:32 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to targetdatabase (not started)
没关系的因为我们的控制文件做了自动备份,在自动备份的控制文件里面已经存在了DBID,我们现在去找找吧,默认就备份在如下位置:
[oracle@wwldb dbs]$ pwd
/DBSoft/product/10.2.0/db_1/dbs
[oracle@wwldb dbs]$ ls
c-5520179-20120518-01 c-5520179-20120523-01 hc_WWL.dat lkWWL
其中5520179就是DBID了,我们只需要通过指定这个DBID,就可以将spfile恢复并将数据库启动到mount状态。
RMAN> set DBID=5520179
executingcommand: SET DBID
RMAN> restore spfile from autobackup;
Starting restoreat 23-MAY-12
using targetdatabase control file instead of recovery catalog
allocatedchannel: ORA_DISK_1
channelORA_DISK_1: sid=39 devtype=DISK
channelORA_DISK_1: looking for autobackup on day: 20120523
channelORA_DISK_1: autobackup found: c-5520179-20120523-04
channelORA_DISK_1: SPFILE restore from autobackup complete
Finished restoreat 23-MAY-12 www.2cto.com
RMAN>
5、恢复控制文件
RMAN> restore controlfile from autobackup;
Starting restoreat 23-MAY-12
using channelORA_DISK_1
channelORA_DISK_1: looking for autobackup on day: 20120523
channelORA_DISK_1: autobackup found: c-5520179-20120523-04
channelORA_DISK_1: control file restore from autobackup complete
outputfilename=/DBSoft/product/10.2.0/db_1