当前位置导航:炫浪网>>网络学院>>编程开发>>Oracle教程

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


  这一类的操作是因为丢失了所有的控制文件,而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>
相关内容
赞助商链接