创建一个临时的spfile文件
在$ORACLE_HOME/dbs下执行
$echo db_name=ora > initora.ora
启动实例到nomount状态
RMAN> startup nomount;
指定dbid
RMAN> set dbid=1302124456;
回复spfile文件
RMAN> restore spfile to '/tmp/spfileora.ora' from autobackup;
创建initora.ora文件
SQL> create pfile from spfile='/tmp/spfileora.ora';
重新启动数据库到nomount状态
RMAN> shutdown immediate;
RMAN> startup nomount;
指定dbid
RMAN> set dbid=1302124456;
回复控制文件
RMAN> restore controlfile to '/tmp/control01.ctl' from autobackup;
如果不清楚dbid可以指定备份片文件
RMAN>restore controlfile from ''/u01/app/oracle/product/102/dbs/c-1302124456-20090426-00';
改变数据库到mount状态
RMAN>alter database mount;
回复数据库
RMAN> restore database;
所有日志文件完整以noresetlogs方式打开数据库
dump控制文件
SQL> alter database backup controlfile to trace;
找出dump的控制文件
SELECT d.VALUE
|| '/'
|| LOWER (RTRIM (i.INSTANCE, CHR (0)))
|| '_ora_'
|| p.spid
|| '.trc' trace_file_name
FROM (SELECT p.spid
FROM v$mystat m, v$session s, v$process p
WHERE m.statistic# = 1 AND s.SID = m.SID AND p.addr = s.paddr) p,
(SELECT t.INSTANCE
FROM v$thread t, v$parameter v
WHERE v.NAME = 'thread'
AND (v.VALUE = 0 OR t.thread# = TO_NUMBER (v.VALUE))) i,
(SELECT VALUE
FROM v$parameter
WHERE NAME = 'user_dump_dest') d
/
重新启动数据库到nomount状态
RMAN> shutdown immediate;
RMAN> startup nomount;
重建控制文件
SQL>
CREATE CONTROLFILE REUSE DATABASE "ORA" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '+DISKGROUP1/ora/onlinelog/group_1.261.683896043' SIZE 50M,
GROUP 2 '+DISKGROUP1/ora/onlinelog/group_2.262.683896043' SIZE 50M,
GROUP 3 '+DISKGROUP1/ora/onlinelog/group_3.263.683896045' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'+DISKGROUP1/ora/datafile/system.256.683895993',
'+DISKGROUP1/ora/datafile/undotbs1.258.683895993',
'+DISKGROUP1/ora/datafile/sysaux.257.683895993',
'+DISKGROUP1/ora/datafile/users.259.683895993'
CHARACTER SET ZHS16GBK
;
恢复数据库
SQL> recover database;
以noresetlogs方式打开数据库
SQL> alter database open;
最近备份以来有日志文件丢失以resetlogs方式打开数据库
恢复数据库
RMAN> recover database;
以resetlogs方式打开数据库
RMAN> alter database open resetlogs;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20844861/viewspace-591878/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/20844861/viewspace-591878/