以下摘录的是redo.log被删除后的恢复步骤
1、打开数据库:
SQL> create table scott.test(jjj number);
Table created.
SQL> insert into scott.test values(10);
1 row created.
SQL> commit ;
SQL> insert into scott.test values(20);
1 row created.
SQL> shutdown abort;
2、模拟破坏,删除三个REDO LOGFILE,重起数据库
SQL> startup
ORACLE instance started.
Total System Global Area 127535132 bytes
Fixed Size 75804 bytes
Variable Size 45461504 bytes
Database Buffers 81920000 bytes
Redo Buffers 77824 bytes
Database mounted.
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: 'E:ORCLORADATAORCLREDO02.LOG'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) O5M3UR2;5=V86(5DND<~!#
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
1 1 18 1048576 1 YES INACTIVE
644621 02-DEC-03
2 1 20 1048576 1 NO CURRENT
644773 02-DEC-03
3 1 19 1048576 1 YES INACTIVE
644726 02-DEC-03
SQL> alter database clear logfile 'E:ORCLORADATAORCLREDO03.LOG';
Database altered.
SQL> alter database clear logfile 'E:ORCLORADATAORCLREDO01.LOG';
Database altered.
SQL> alter database clear logfile 'E:ORCLORADATAORCLREDO02.LOG';
alter database clear logfile 'E:ORCLORADATAORCLREDO02.LOG'
*ERROR at line 1:
ORA-01624: log 2 needed for crash recovery of thread 1
ORA-00312: online log 2 thread 1: 'E:ORCLORADATAORCLREDO02.LOG'
SQL> recover database until cancel;
ORA-00279: change 644818 generated at 12/03/2003 13:56:53 needed for thread 1
ORA-00289: suggestion : E:ORCLORADATAORCLARCHIVEORCLT001S00020.ARC
ORA-00280: change 644818 for thread 1 is in sequence #20
Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 644885 generated at 12/03/2003 09:07:26 needed for thread 1
ORA-00289: suggestion : E:ORCLORADATAORCLARCHIVEORCLT001S00021.ARC
ORA-00280: change 644885 for thread 1 is in sequence #21
ORA-00278: log file 'E:ORCLORADATAORCLARCHIVEORCLT001S00020.ARC' no longer
needed for this recovery
ORA-00279: change 644904 generated at 12/03/2003 09:10:53 needed for thread 1
ORA-00289: suggestion : E:ORCLORADATAORCLARCHIVEORCLT001S00022.ARC
ORA-00280: change 644904 for thread 1 is in sequence #22
ORA-00278: log file 'E:ORCLORADATAORCLARCHIVEORCLT001S00021.ARC' no longer
needed for this recovery
ORA-00328: archived log ends at change 503449, need later change 644904
ORA-00334: archived log: 'E:ORCLORADATAORCLARCHIVEORCLT001S00022.ARC'
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: 'E:ORCLORADATAORCLSYSTEM01.DBF'
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: 'E:ORCLORADATAORCLSYSTEM01.DBF'
SQL> alter database open ;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
3、在INIT参数文件中加入_allow_resetlogs_corruption=true以后重起:
SQL> startup mount
ORACLE instance started.
Total System Global Area 127535132 bytes
Fixed Size 75804 bytes
Variable Size 45461504 bytes
Database Buffers 81920000 bytes
Redo Buffers 77824 bytes
Database mounted.
SQL> alter database open resetlogs;
Database altered.
修改的数据都丢失了。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/51862/viewspace-180553/ ,如需转载,请注明出处,否则将追究法律责任。