使用隐含参数模拟Oracle数据库服务器掉,重做日志丢失打开数据库

2014-11-24 18:46:50 · 作者: · 浏览: 0

SQL> set linesize 150 pagesize 300
SQL> select * from v$log;


GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 25 52428800 1 NO CURRENT 384492 29-JAN-12
2 1 23 52428800 1 NO INACTIVE 371795 29-JAN-12
3 1 24 52428800 1 NO INACTIVE 377698 29-JAN-12
采用shutdown abort模拟突然掉电,数据库关闭的情形,此时数据库可以正常启动到MOUNT状态
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.


Total System Global Area 1610612736 bytes
Fixed Size 2084296 bytes
Variable Size 385876536 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14692352 bytes
Database mounted.
此时日志状态如下:
SQL> select * from v$log;


GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 25 52428800 1 NO ACTIVE 384492 29-JAN-12
3 1 27 52428800 1 NO CURRENT 391086 29-JAN-12
2 1 26 52428800 1 NO ACTIVE 389733 29-JAN-12
删除所有的重做日志文件:
SQL>!rm /u01/app/oracle/oradata/marven/redo*.log
SQL> shutdown abort
ORACLE instance shut down.


SQL>startup nomount


Total System Global Area 1610612736 bytes
Fixed Size 2084296 bytes
Variable Size 385876536 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14692352 bytes
SQL> alter database mount;


Database altered.


在打开数据库时发现无法正常打开
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/marven/redo01.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
试图通过resetlog打开数据库发现是行不通的:
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery


spfile参数文件的目录如下:
SQL> show parameter spfile;


NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/10.2.0
/db_1/dbs/spfilemarven.ora