eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« 300美元一股的股票还值得买进吗? | Blog首页 | 如何使用sqlldr的WHEN判断加载数据到不同的数据表 »

如何从备份集中恢复归档日志

这一类的操作是因为丢失了所有的控制文件,而RMAN的备份信息又存储在控制文件之中。

所以只能使用DMBS_BACKUP_RESTORE从备份集中恢复数据文件、归档日志等进行恢复。

本例示范如何恢复归档日志文件,恢复数据文件的例子参考:应对RMAN-06026错误,使用dbms_backup_restore进行恢复

SQL> DECLARE
 2   devtype varchar2(256);
 3   done boolean;
 4   BEGIN
 5   devtype:=sys.dbms_backup_restore.deviceAllocate(type=>'',ident=>'t1');
 6   sys.dbms_backup_restore.restoreSetArchivedLog(destination=>'D:\oracle\oradata\eygle\archive');
 7   sys.dbms_backup_restore.restoreArchivedLog(thread=>1,sequence=>6);
 8   sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle=>'D:\oracle\oradata\eygle\bak\ARCH_EYGLE_20050702_7',params=>null);
 9   sys.dbms_backup_restore.deviceDeallocate;
10  END;
11  /

PL/SQL procedure successfully completed.

执行不完全恢复以后,resetlogs打开数据库:
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 459405 generated at 07/02/2005 23:58:32 needed for thread1
ORA-00289: suggestion : D:\ORACLE\ORADATA\EYGLE\ARCHIVE\ARC16.ARC
ORA-00280: change 459405 for thread 1 is in sequence #6

Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00279: change 459428 generated at 07/02/2005 23:59:32 needed for thread1
ORA-00289: suggestion : D:\ORACLE\ORADATA\EYGLE\ARCHIVE\ARC17.ARC
ORA-00280: change 459428 for thread 1 is in sequence #7
ORA-00278: log file 'D:\ORACLE\ORADATA\EYGLE\ARCHIVE\ARC16.ARC' no longer needed for this recovery

Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00279: change 459516 generated at 07/03/2005 00:02:40 needed for thread1
ORA-00289: suggestion : D:\ORACLE\ORADATA\EYGLE\ARCHIVE\ARC18.ARC
ORA-00280: change 459516 for thread 1 is in sequence #8
ORA-00278: log file 'D:\ORACLE\ORADATA\EYGLE\ARCHIVE\ARC17.ARC' no longer needed for this recovery

Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00328: archived log ends at change 456840, need later change 459516
ORA-00334: archived log: 'D:\ORACLE\ORADATA\EYGLE\ARCHIVE\ARC18.ARC'

SQL> recover database using backup controlfile until cancel;
ORA-00279: change 459516 generated at 07/03/2005 00:02:40 needed for thread1
ORA-00289: suggestion : D:\ORACLE\ORADATA\EYGLE\ARCHIVE\ARC18.ARC
ORA-00280: change 459516 for thread 1 is in sequence #8

Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SQL> alter database open resetlogs;

Database altered.

SQL>


恢复完毕.
历史上的今天...
    >> 2017-07-03文章:
    >> 2011-07-03文章:
    >> 2008-07-03文章:
           ORA-00704 与 bootstrap 错误
    >> 2007-07-03文章:
    >> 2006-07-03文章:
           招聘Oracle DBA一名
    >> 2004-07-03文章:

无觅

By eygle on 2005-07-03 09:26 | Comments (2) | Backup&Recovery | 327 |

2 Comments

"......resetlogs之后,Oracle使用当前的控制文件不允许从这个历史备份集中进行恢复...."

如果在rman备份是同时备份了控制文件。在恢复时,先从mrna备份集中恢复控制文件,然后在恢复数据库可以吗?

我做过试验,数据库在非归档模式下,rman全备数据库,控制文件自动备份,后来进行了一次不完全恢复。把数据库恢复到备份的状态。
一段时间后,我再进行恢复,先是恢复控制文件,然后再restore database,提示出错。出错信息和上面第一个黑图表示的错误以信息一样。

非归档模式就没有任何问题,即使没有备份控制文件,只要重建控制文件之后就可以启动了。


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com