ORA-01152 故障解決

lwitpub發表於2012-03-29
今天在測試庫上做RMAN備份恢復實驗時,open resetlogs階段出現了錯誤:
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/opt/oracle/oradata/dbp/system01.dbf'
突然想起以前在此庫做過一個RMAN configuration(備份時exclude system tablespace),應該是因此恢復時才會提示報錯。
如下恢復步驟:
set DBID
restore spfile from.
restore controlfile from.
RMAN> restore database;

Starting restore at 29-MAR-12
using channel ORA_DISK_1
using channel ORA_DISK_2

file 7 is excluded from whole database backup
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 03/29/2012 14:16:17
RMAN-06026: some targets not found - aborting restore

file 7 is excluded from whole database backup
restore not done;

從此處可以看出,實際上restore 就沒有完成。

RMAN>
run{
set until scn 61182896;
restore database;
restore archivelog all;
recover database;
alter database open resetlogs;}
……………………………………………………………………
allocated channel: c1
channel c1: sid=13 devtype=DISK

Starting restore at 02-AUG-05

released channel: c1
…………………………………………………………
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 7 found to restore

RMAN> alter database open resetlogs;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 03/29/2012 15:50:21
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/opt/oracle/oradata/dbp/system01.dbf'


RMAN> list incarnation ;

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       DBP      1761361519       PARENT  1          17-FEB-08
2       2       DBP      1761361519       PARENT  464631     21-JUN-10
3       3       DBP      1761361519       PARENT  579893     28-JUN-10
4       4       DBP      1761361519       PARENT  1116645    14-AUG-10
5       5       DBP      1761361519       CURRENT 1117950    14-AUG-10
6       6       DBP      1761361519       ORPHAN  19093809   04-JAN-12
7       7       DBP      1761361519       ORPHAN  61604278   26-MAR-12

當restore 單個datafile 時,也有報錯
ORA-01178: file 7 created before last CREATE CONTROLFILE, cannot recreate

解決方法:重建控制檔案
SQL> shutdown immediate

ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> SQL> SQL>
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1073741824 bytes
Fixed Size            1271616 bytes
Variable Size          297797824 bytes
Database Buffers      767557632 bytes
Redo Buffers            7114752 bytes

SQL>CREATE CONTROLFILE REUSE DATABASE "DBP" RESETLOGS  ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/opt/oracle/oradata/dbp/redo01.log'  SIZE 50M,
GROUP 2 '/opt/oracle/oradata/dbp/redo02.log'  SIZE 50M,
GROUP 3 '/opt/oracle/oradata/dbp/redo03.log'  SIZE 50M
DATAFILE
'/opt/oracle/oradata/dbp/system01.dbf',
'/opt/oracle/oradata/dbp/undotbs01.dbf',
'/opt/oracle/oradata/dbp/sysaux01.dbf',
'/opt/oracle/oradata/dbp/users01.dbf',
'/opt/oracle/oradata/dbp/TOSS_WAPS_DATA.dbf',
'/opt/oracle/oradata/dbp/waps_data1.dbf',
'/opt/oracle/oradata/dbp/waps_data3.dbf'
 19  ;

Control file created.

SQL> recover database until cancel using backup controlfile;
ORA-00279: change 61718297 generated at 03/29/2012 10:57:31 needed for thread 1
ORA-00289: suggestion : /opt/oracle/flash_recovery_area/1_12_778932065.dbf
ORA-00280: change 61718297 for thread 1 is in sequence #12


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

connected.
SQL> startup force
ORACLE instance started.

Total System Global Area 1073741824 bytes
Fixed Size            1271616 bytes
Variable Size          297797824 bytes
Database Buffers      767557632 bytes
Redo Buffers            7114752 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> alter database open resetlogs;

Database altered.

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

相關文章