RMAN-06026 錯誤分析與解決

wuweilong發表於2012-07-26

RMAN-06026 錯誤分析與解決

背景:
之前做了基於SCN的不完全恢復,在嘗試恢復的過程中使用了_allow_resetlogs_corruption引數,resetlogs之後,Oracle使用的當前控制檔案不允許
從這個歷史的備份集中進行恢復,從而導致了RMAN-06026這個錯誤,錯誤現象如下:


錯誤現象:
RMAN> restore database;

Starting restore at 26-JUL-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=47 devtype=DISK

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/26/2012 12:41:17
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 7 found to restore
RMAN-06023: no backup or copy of datafile 6 found to restore
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of datafile 4 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_resetore 這個包來制定路徑進行資料庫的手工恢復,詳細步驟如下:


解決辦法:
執行dbms_backup_restore包來進行恢復:

DECLARE
devtype varchar2(256);
done boolean;
BEGIN
devtype:=sys.dbms_backup_restore.deviceAllocate (type=>'',ident=>'FUN');
sys.dbms_backup_restore.restoreSetDatafile;
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>01,toname=>'/DBBak2/oradata/WWL/system01.dbf');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>02,toname=>'/DBBak2/oradata/WWL/undotbs01.dbf');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>03,toname=>'/DBBak2/oradata/WWL/sysaux01.dbf');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>04,toname=>'/DBBak2/oradata/WWL/users01.dbf');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>05,toname=>'/DBBak2/oradata/WWL/wwl001.dbf');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>06,toname=>'/DBBak2/oradata/WWL/wwl002.dbf');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>07,toname=>'/DBBak2/oradata/WWL/wwl003.dbf');
sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle=>'/DBSoft/product/10.2.0/db_1/dbs/0pnh23kk_1_1', params=>null);
sys.dbms_backup_restore.deviceDeallocate;
END;
/


執行步驟如下:

1、將資料庫啟動到nomount狀態
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 100663296 bytes
Fixed Size 1217884 bytes
Variable Size 88083108 bytes
Database Buffers 8388608 bytes
Redo Buffers 2973696 bytes

2、執行手工恢復包
SQL>DECLARE
done boolean;
devtype varchar2(256);
done boolean;
BEGIN
devtype:=sys.dbms_backup_restore.deviceAllocate (type=>'',ident=>'FUN');
6 sys.dbms_backup_restore.restoreSetDatafile;
7 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>01,toname=>'/DBBak2/oradata/WWL/system01.dbf');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>02,toname=>'/DBBak2/oradata/WWL/undotbs01.dbf');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>04,toname=>'/DBBak2/oradata/WWL/wwl001.dbf');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>03,toname=>'/DBBak2/oradata/WWL/users01.dbf');
END;
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>04,toname=>'/DBBak2/oradata/WWL/wwl001.dbf');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>05,toname=>'/DBBak2/oradata/WWL/wwl002.dbf');
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>06,toname=>'/DBBak2/oradata/WWL/wwl003.dbf');
sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle=>'/DBSoft/product/10.2.0/db_1/dbs/0mnh01jv_1_1', params=>null);
sys.dbms_backup_restore.deviceDeallocate;
END;
16 /

PL/SQL procedure successfully completed.

SQL>


3、生成備份控制檔案的trace
SQL> alter database backup controlfile to trace;

Database altered.


4、重建控制檔案
SQL>CREATE CONTROLFILE REUSE DATABASE "WWL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 4 (
'/DBBak2/oradata/WWL/redo4a.log',
'/DBBak2/oradata/WWL/redo4b.log'
) SIZE 128M,
GROUP 5 (
'/DBBak2/oradata/WWL/redo5a.log',
'/DBBak2/oradata/WWL/redo5b.log'
) SIZE 128M,
GROUP 6 (
'/DBBak2/oradata/WWL/redo6a.log',
'/DBBak2/oradata/WWL/redo6b.log'
) SIZE 128M,
GROUP 7 (
'/DBBak2/oradata/WWL/redo7a.log',
'/DBBak2/oradata/WWL/redo7b.log'
) SIZE 128M
-- STANDBY LOGFILE
DATAFILE
'/DBBak2/oradata/WWL/system01.dbf',
'/DBBak2/oradata/WWL/undotbs01.dbf',
'/DBBak2/oradata/WWL/sysaux01.dbf',
'/DBBak2/oradata/WWL/users01.dbf',
'/DBBak2/oradata/WWL/wwl01.dbf',
'/DBBak2/oradata/WWL/wwl02.dbf',
'/DBBak2/oradata/WWL/wwl03.dbf'
CHARACTER SET ZHS16CGB231280

Database altered.

5、啟動資料庫
SQL>alter database open resetlogs;

Database altered.

SQL> select instance_name,status from v$instance;

INSTANCE_NAME STATUS
---------------- ------------
WWL OPEN

SQL>


建議最後對資料庫做一次全備。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20674423/viewspace-737071/,如需轉載,請註明出處,否則將追究法律責任。

相關文章