1.
执行还原时显示DATAFILE 12即APP01.ORA OFFLINE,没有被还原:
RMAN TARGET SYS/SYS@RAINNY CATALOG CATALOG/CATALOG@OEMREP
(1) 还原SPFILE
RMAN>STARTUP FORCE NOMOUNT;
RMAN>RESTORE SPFILE;
(2) 还原CONTROL FILE
RMAN>SHUTDOWN IMMEDIATE;
RMAN>STARTUP NOMOUNT;
RMAN>RESTORE CONTROLFILE;
RMAN>ALTER DATABASE MOUNT;
RMAN>RESTORE DATABASE;
RMAN>RECOVER DATABASE;
这时报:datafile 12 need to be restored!
(3) 试图还原datafile 12
RMAN>restore datafile 12;
报: RMAN-06023: no backup or copy of datafile 12 found to restore
RMAN>list backup of database
在备份列表中datafile 12又明明存在,为什么还会报找不到备份集呢?也许是我有做过表空间时间点恢复的原因.
2. 在此只好用
dbms_backup_restore
包来还原数据文件
12:APP01.ORA
sqlplus /nolog
SQL>conn sys/sys@rainny as sysdba;
SQL>shutdown immediate;
SQL>startup nomount;
开始执行还原数据文件12:
DECLARE
devtype
varchar2
(
256
);
done
boolean
;
BEGIN
devtype:
=
sys
.dbms_backup_restore.deviceAllocate
(
type
=>
''
,
ident
=>
'I1'
);
sys
.dbms_backup_restore.restoreSetDatafile
;
sys
.dbms_backup_restore.restoreDatafileTo
(
dfnumber
=>
12
,
toname
=>
'D:\ORACLE_HOME\ORADATA\RAINNY\APP01.ORA'
);
sys
.dbms_backup_restore.restoreBackupPiece
(
done
=>
done
,
handle
=>
'F:\zq_orabackup\RAINNY_20061222_0OI5J6KU_1_1.BAK'
,
params
=>
null
);
sys
.dbms_backup_restore.deviceDeallocate
;
END
;
/
数据文件12被还原,mount数据库,我们现在要恢复数据库:
SQL> alter database mount;
Database altered.
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 32493938 generated at 12/22/2006 15:32:30 needed for thread 1
ORA-00289: suggestion : D:\ORACLE_HOME\RDBMS\ARC00006.001
ORA-00280: change 32493938 for thread 1 is in sequence #6
Specify log: { =suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SQL> alter database open resetlogs;
Database altered.
SQL>
至此,数据库成功恢复!,现在赶紧做一个数据库备份吧.