oracle sys.dbms_backup_restore包恢复数据

来源:互联网 发布:java redis连接池配置 编辑:程序博客网 时间:2024/06/07 03:34


RMAN> restore tablespace system;


Starting restore at 12-MAY-17
using channel ORA_DISK_1


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/12/2017 23:02:08
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 1 found to restore


由于备份时用nocatalog,使用rman作异库恢复时,遇到如上问题


rman target / log /u01/rman.log


RMAN> list backup;


通过list backup信息
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
60883   Incr 0  3.50G      DISK        00:11:39     08-MAY-17      
        BP Key: 60883   Status: EXPIRED  Compressed: YES  Tag: XEZF_LEV0
        Piece Name: /u01/backup/backupsets/xezf_lev0_ers3mn1l_1_1_20170508
  List of Datafiles in backup set 60883
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1    0  Incr 14372183267 08-MAY-17 /u02/oradata/xezf/system01.dbf
  .................................................................


shutdown immediate;
startup nomount;
DECLARE
 devtype varchar2(256);
 done boolean;
 BEGIN
 devtype:=sys.dbms_backup_restore.deviceAllocate (type=>'',ident=>'t1');
 sys.dbms_backup_restore.restoreSetDatafile;
 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>01,toname=>'/u02/oradata/xezf/system01.dbf');
 sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle=>'/u01/backup/backupsets/xezf_lev0_ers3mn1l_1_1_20170508', params=>null);
 sys.dbms_backup_restore.deviceDeallocate;
END;
/






BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
60890   Incr 0  5.10G      DISK        00:15:52     08-MAY-17      
        BP Key: 60890   Status: EXPIRED  Compressed: YES  Tag: XEZF_LEV0
        Piece Name: /u01/backup/backupsets/xezf_lev0_f0s3mpao_1_1_20170508
  List of Datafiles in backup set 60890
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  3    0  Incr 14372390786 08-MAY-17 /u02/oradata/xezf/sysaux01.dbf
  .................................................................
  
shutdown immediate;
startup nomount;
DECLARE
 devtype varchar2(256);
 done boolean;
 BEGIN
 devtype:=sys.dbms_backup_restore.deviceAllocate (type=>'',ident=>'t1');
 sys.dbms_backup_restore.restoreSetDatafile;
 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>03,toname=>'/u02/oradata/xezf/sysaux01.dbf');
 sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle=>'/u01/backup/backupsets/xezf_lev0_f0s3mpao_1_1_20170508', params=>null);
 sys.dbms_backup_restore.deviceDeallocate;
END;
/



0 0