--备份控制文件 rman target / RMAN> startup RMAN> configure controlfile autobackup on; --启动自动备份 RMAN> show CONTROLFILE AUTOBACKUP; --显示是否自动备份控制文件 RMAN> configure controlfile autobackup format for device type disk to ‘/backup/%F‘; --设置控制文件备份路径 RMAN> show controlfile autobackup format; --显示自动备份控制文件路径 RMAN> list backup of controlfile;--显示备份信息 ----手动备份控制文件 RMAN> backup as backupset current controlfile; --------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- --恢复控制文件 --未开启自动归档的情况 RMAN> startup nomount RMAN> restore controlfile from ‘=/backup/c-1415711864-20150817-00‘; RMAN> startup mount; RMAN> recover database; RMAN> alter database open resetlogs; ---开启自动归档的情况 SQL> recover database;--(因为启动自动归档模式,这里报错) ORA-00283: recovery session canceled due to errors ORA-01610: recovery using the BACKUP CONTROLFILE option must be done SQL> recover database using backup controlfile; Specify log: {=suggested | filename | AUTO | CANCEL} /oracle/u01/app/oracle/oradata/orcl/redo01.log(这里指定日志文件路径,但是这样恢复后又没有丢数,真是怪?) SQL>alter database open resetlogs;
--备注:还可以通过重建控制文件的方式恢复
--备注:恢复控制文件后启动数据库,报下面这个错,是因为控制文件的SCN跟数据文件不一致,所以需要使用recover命令,上面两个因为一个启动归档模式,另一个没启动,所以有差别
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 08/17/2015 23:16:07
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: ‘/app/oracle/oradata/orcl/system01.dbf‘
时间: 2024-10-25 15:55:55