导言:如果你的数据库昨天下午5点做全了备份,昨天晚上7点为表空间增加了文件。今天早上数据库磁盘坏了。 请问:
1,数据库能够完全恢复吗?
2,如何恢复?
我回答:应该可以,但是具体步骤吗。。。。这个当时真的头晕了。。没有回答出来。 惭愧呀。。。。
实验环境:
WINDOWS+ ORACLE9.2.0.1,
操作步骤:
1, rman backup full database ;
2, rman backup current control file ;
3, sql> create tablespace ts_lost datafile size 10m;
4, sql> create table t1 tablespace ts_lost as ..... ;
sql> create table t2 tablespace ts_lost as ..... ;
alter system switch logfile ;
5, shutdown immediate ;
6, delete all database files (control files, dtafiles) from disk, exclude redolog file .
-----------------OK, now let's see how to completely recover the database .
step :
1, sql> startup nomount
2,rman> restore controlfile from "ctl.bak" ;
3,
# rman> restore database ; --- get error. because file "ts_lost " not backuped.
RMAN-03002: failure of restore command at 05/11/2010 18:48:27
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 12 found to restore
But I have a question. How oracle know the newest datafile with the old backup controlfile. Maybe It look at file from system tablespace
sql> select file# from v$recover_file ; -- assume 1,2,3,4,5,6,7
rman> restore datafile 1 ;
rman> restore datafile 2 ;
rman> restore datafile 3 ;
...........
4,
alter database create datafile 12 as 'C:\oracle\oradata\mydb\ts_test.dbf' ;
5, recover database using backup controlfile;
19:12:05 SQL> recover database using backup controlfile ;
ORA-00279: change 2098519 generated at 05/11/2010 17:22:11 needed for thread 1
ORA-00289: suggestion : C:\ORACLE\ORADATA\ARC00034.001
ORA-00280: change 2098519 for thread 1 is in sequence #34
19:12:13 Specify log: {=suggested | filename | AUTO | CANCEL}
ORA-00279: change 2098606 generated at 05/11/2010 17:24:46 needed for thread 1
ORA-00289: suggestion : C:\ORACLE\ORADATA\ARC00035.001
ORA-00280: change 2098606 for thread 1 is in sequence #35
ORA-00278: log file 'C:\ORACLE\ORADATA\ARC00034.001' no longer needed for this recovery
19:12:20 Specify log: {=suggested | filename | AUTO | CANCEL}
C:\oracle\oradata\mydb\redo01.log
Log applied.
Media recovery complete.
--note, you must sure the archive log and the latest online redo log pathname.
If oracle prompt a not exist archived log to apply, then it means to apply an online redo logfile . Then should manually input the redolog pathname .
6, alter database open resetlogs; -- because we use backup controlfile to restore and recover database, so must use resetlogs to open db.
memo:
1, only recover database can use "using backup controlfile" caluse
19:11:39 SQL> recover datafile 12 using backup controlfile ;
ORA-00274: illegal recovery option USING
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/350519/viewspace-662461/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/350519/viewspace-662461/