恢复前提有数据备份
以 alter database open resetlogs 开机以后多要做一次全备(以前的备份失效了)
恢复参数文件:
restore spfile from '/home/oracle/bak/PROD4_25s8i1dp_1_1.spfile';
恢复控制文件:
rman>restore controlfile from '/home/oracle/bak/ctl_PROD4_20170705_68_1';
rman>alter database mount;
恢复数据文件:
rman> alter database open; #报错
rman>list failure; #查看错误
rman>advise failure; #恢复建议
rman>repair failure; #恢复-- yes
恢复一个普通表空间:
SQL> alter tablespace users offline;
RMAN> restore tablespace users; #如果不行,关机 然后开启到mount状态
SQL>shutdown abort mount;
RMAN> restore tablespace users;
RMAN> recover database;
SQL> alter database open;
SQL> alter tablespace users online;
恢复所有.dbf 数据文件:
SQL>shutdown abort
RMAN> startup
RMAN> restore database;
RMAN> recover dastabase;
alter database open;
恢复控制文件:
shutdown abort
RMAN>startup #nomount
恢复控制文件:
RMAN>restore controfile from '/home/oracle/bak/ctlxxx';
alter database mount;
RMAN>recover database
alter database open resetlog;
当前redo文件损坏
恢复:
shutdown abort
rman>startup #
删除 控制文件,恢复:
rm *.ctl
SQL>shutdown abort
rman> startup
rman>restore controlfile from '/xxx/xx';
alter database mount;
recover database; #xxxx
recover database until scn xxxx;
#alter database recover if needed start until change xxx using backup controlfile;
#这些步骤多是垂死挣扎了,多没有用(直接删除控制文件,删除数据文件,然后全库恢复)
删除 数据文件,恢复:
rm -rf *.dbf
RMAN> restore database;
RMAN> recover database; #报错 (但是数据文件,控制文件是一致)
rman>recover database until scn xxx;
alter database open resetlog;
#当前redo 损坏 ,必然丢数据的。