有疑问的话就试一下!当然可以恢复的!如果联机日志没有丢失的话,那么可以实现完全恢复。如果联机日志丢失的话,只能实现不完全恢复,也就是说只能恢复到最后一个归档日志的内容。我的测试过程:
[php]
idle> archive log list
Database log mode
No Archive Mode
Automatic archival
Enabled
Archive destination
d:\oracle\oradata\DEMO\archive
Oldest online log sequence 163
Current log sequence 164
idle> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
idle> startup mount
ORACLE instance started.
Total System Global Area
59841036 bytes
Fixed Size
453132 bytes
Variable Size
33554432 bytes
Database Buffers
25165824 bytes
Redo Buffers
667648 bytes
Database mounted.
idle> alter database archivelog;
Database altered.
idle> alter database open;
Database altered.
idle> archive log list
Database log mode
Archive Mode
Automatic archival
Enabled
Archive destination
d:\oracle\oradata\DEMO\archive
Oldest online log sequence 163
Next log sequence to archive 164
Current log sequence 164
idle> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
--在这里做个冷备份
idle> startup
ORACLE instance started.
Total System Global Area
59841036 bytes
Fixed Size
453132 bytes
Variable Size
33554432 bytes
Database Buffers
25165824 bytes
Redo Buffers
667648 bytes
Database mounted.
Database opened.
--创建测试表,验证恢复
idle> create table t(a int) tablespace users
2;
Table created.
idle> begin
2for i in 1.. 10000 loop
3 insert into t values(i);
4end loop;
5end;
6/
PL/SQL procedure successfully completed.
idle> commit;
Commit complete.
idle> alter system switch logfile;
System altered.
idle> alter database backup controlfile to trace;
Database altered.
--模拟掉电,接下删除全部数据文件、控制文件、日志文件
idle> shutdown abort
ORACLE instance shut down.
idle> startup
ORACLE instance started.
Total System Global Area
59841036 bytes
Fixed Size
453132 bytes
Variable Size
33554432 bytes
Database Buffers
25165824 bytes
Redo Buffers
667648 bytes
ORA-00205: error in identifying controlfile, check alert log for more info
--把冷备的数据文件复原至数据文件的相应目录,并重建控制文件,
idle> ed
Wrote file afiedt.buf
1CREATE CONTROLFILE REUSE DATABASE "DEMO" RESETLOGSARCHIVELOG
2--SET STANDBY TO MAXIMIZE PERFORMANCE
3MAXLOGFILES 32
4MAXLOGMEMBERS 2
5MAXDATAFILES 32
6MAXINSTANCES 16
7MAXLOGHISTORY 1815
8LOGFILE
9GROUP 1 'D:\ORACLE\ORADATA\DEMO\REDO01.LOG'SIZE 5M,
10GROUP 2 'D:\ORACLE\ORADATA\DEMO\REDO02.LOG'SIZE 5M
11-- STANDBY LOGFILE
12DATAFILE
13'D:\ORACLE\ORADATA\DEMO\SYSTEM01.DBF',
14'D:\ORACLE\ORADATA\DEMO\UNDOTBS01.DBF',
15'D:\ORACLE\ORADATA\DEMO\USERS01.DBF'
16* CHARACTER SET ZHS16GBK
idle> /
--开始进行不完全恢复,手工应用归档日志进行恢复
idle> recover database until cancel using backup controlfile;
ORA-00279: change 1826731 generated at 02/09/2006 11:00:11 needed for thread 1
ORA-00289: suggestion : D:\ORACLE\ORADATA\DEMO\ARCHIVE\164.ARC
ORA-00280: change 1826731 for thread 1 is in sequence #164
Specify log: {=suggested | filename | AUTO | CANCEL}
D:\ORACLE\ORADATA\DEMO\ARCHIVE\164.ARC
ORA-00279: change 1846914 generated at 02/09/2006 11:12:57 needed for thread 1
ORA-00289: suggestion : D:\ORACLE\ORADATA\DEMO\ARCHIVE\165.ARC
ORA-00280: change 1846914 for thread 1 is in sequence #165
ORA-00278: log file 'D:\ORACLE\ORADATA\DEMO\ARCHIVE\164.ARC' no longer needed fo
r this recovery
Specify log: {=suggested | filename | AUTO | CANCEL}
D:\ORACLE\ORADATA\DEMO\ARCHIVE\165.ARC
ORA-00279: change 1847092 generated at 02/09/2006 11:13:56 needed for thread 1
ORA-00289: suggestion : D:\ORACLE\ORADATA\DEMO\ARCHIVE\166.ARC
ORA-00280: change 1847092 for thread 1 is in sequence #166
ORA-00278: log file 'D:\ORACLE\ORADATA\DEMO\ARCHIVE\165.ARC' no longer needed fo
r this recovery
Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
--以resetlogs打开数据库,验证恢复成功
idle> alter database open resetlogs;
Database altered.
idle> select count(*) from t;
COUNT(*)
----------
10000
...
[/php] |