测试环境模拟数据库宕机再启动出现当前联机日志损坏
SQL> conn / as sysdba
SQL> select group#,sequence#,status from v$log;
GROUP# SEQUENCE# STATUS
---------- ---------- ----------------
1 1 CURRENT
2 0 UNUSED
3 0 UNUSED
SQL> conn test/1
Connected.
--插入数据并提交
SQL> begin
2 for v in 1..100 loop
3 insert into test values(11,'qq');
4 end loop;
5 end;
6 /
PL/SQL procedure successfully completed.
SQL> commit;
Commit complete.
--插入数据不提交
SQL> begin
2 for v in 1..100 loop
3 insert into test values(22,'aa');
4 end loop;
5 end;
6 /
PL/SQL procedure successfully completed.
SQL> select count(*) from test;
COUNT(*)
----------
200
SQL> conn / as sysdba
Connected.
--不一致停库
SQL> shutdown abort;
ORACLE instance shut down.
oracle@DB:[/u01/app/oracle/oradata/orcl]ll redo*
-rw-rw----. 1 oracle oracle 52429312 Oct 21 16:16 redo01.log
-rw-rw-r--. 1 oracle oracle 52429312 Oct 21 16:16 redo02.log
-rw-rw-r--. 1 oracle oracle 52429312 Oct 21 16:16 redo03.log
--重命名当前日志
oracle@DB:[/u01/app/oracle/oradata/orcl]mv redo01.log redo01.log.bak
SQL> startup
ORACLE instance started.
Total System Global Area 221331456 bytes
Fixed Size 2251856 bytes
Variable Size 163578800 bytes
Database Buffers 50331648 bytes
Redo Buffers 5169152 bytes
Database mounted.
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/orcl/redo01.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/orcl/redo01.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> recover database until cancel;
ORA-00279: change 7532876 generated at 10/21/2016 16:00:04 needed for thread 1
ORA-00289: suggestion : /home/oracle/arch4-bak/1_1_925768605.dbf
ORA-00280: change 7532876 for thread 1 is in sequence #1
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
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: '/u01/app/oracle/oradata/orcl/system01.dbf'
ORA-01112: media recovery not started
--创建pfile
SQL> create pfile='/home/oracle/pfile.ora' from spfile;
File created.
SQL> shutdown abort;
ORACLE instance shut down.
--加入隐含参数
oracle@DB:[/u01/app/oracle/oradata/orcl]cat /home/oracle/pfile.ora|grep _allow
_allow_resetlogs_corruption=TRUE
_allow_error_simulation=TRUE
SQL> startup pfile='/home/oracle/pfile.ora';
ORACLE instance started.
Total System Global Area 221331456 bytes
Fixed Size 2251856 bytes
Variable Size 163578800 bytes
Database Buffers 50331648 bytes
Redo Buffers 5169152 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-00704: bootstrap process failure
ORA-00600: internal error code, arguments: [2662], [0], [7532883], [0],
[7533126], [4194545], [], [], [], [], [], []
Process ID: 5001
Session ID: 1 Serial number: 5
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup mount pfile='/home/oracle/pfile.ora';
ORACLE instance started.
Total System Global Area 221331456 bytes
Fixed Size 2251856 bytes
Variable Size 163578800 bytes
Database Buffers 50331648 bytes
Redo Buffers 5169152 bytes
Database mounted.
SQL> recover database until cancel;
ORA-00279: change 7552886 generated at 10/21/2016 16:12:34 needed for thread 1
ORA-00289: suggestion : /home/oracle/arch4-bak/1_2_925834283.dbf
ORA-00280: change 7552886 for thread 1 is in sequence #2
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
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: '/u01/app/oracle/oradata/orcl/system01.dbf'
ORA-01112: media recovery not started
--推进SCN
SQL> alter session set events '10015 trace name adjust_scn level 1';
Session altered.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 5115
Session ID: 1 Serial number: 5
在无备份和归档情况下,数据库宕机再启动出现当前日志损坏,应该怎么恢复呀?