【Vegas原创】用dbms_backup_restore解决RMAN-06026 06023错误
现象:从备份集还原出来的controlfile,用此进行rman还原时,报以下错误:
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore
解决方法:
用dbms_backup_restore package进行恢复。
1,Startup nomount;
2,执行恢复:
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=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\SYSTEM01.DBF');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>02,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\UNDOTBS01.DBF');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>03,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\SYSAUX01.DBF');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>04,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\USERS01.DBF');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>05,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\EXAMPLE01.DBF');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>06,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\DRSYS');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>07,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\INDX');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>08,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\RBS');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>09,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\TOOLS');
sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle=>'D:\HISDBRman\DF343_1_714024003', params=>null);
sys.dbms_backup_restore.deviceDeallocate;
END;
/
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=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\SYSTEM01.DBF');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>02,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\UNDOTBS01.DBF');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>03,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\SYSAUX01.DBF');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>04,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\USERS01.DBF');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>05,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\EXAMPLE01.DBF');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>06,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\DRSYS');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>07,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\INDX');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>08,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\RBS');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>09,toname=>'E:\ORACLE\PRODUCT\10.2.0\ORADATA\HISDB\TOOLS');
sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle=>'D:\HISDBRman\DF343_1_714024003', params=>null);
sys.dbms_backup_restore.deviceDeallocate;
END;
/
ps:如果有两到三个备份集,需要分开执行以上的代码,替换
sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle=>'D:\HISDBRman\DF343_1_714024003', params=>null);
到另一个备份集。
3,看看control文件在不
如果rman备份集里有,就直接:
RMAN> restore controlfile from 'F:\tmp\DF344_1_714024149';
如果没有,则:
alter database backup controlfile to trace;
找到trace文件,重建你的control文件
4,执行恢复:
SQL> recover database using backup controlfile until cancel;
5,如果4步骤中出现log问题不让恢复的话,参看:
http://www.cnblogs.com/Vegaslee/archive/2010/03/26/1696698.html 联机日志丢失,recover database until cancel不可以的解决方法
6, open resetlogs,好了。
参考文档:http://www.eygle.com/archives/2005/06/oorman06026iioe.html
喜欢请赞赏一下啦^_^