从报警日志可以看出,第一组重做日志文件组丢了,我们可以通过sql语句“alter database clear logfile group 1;”重建日志文件组;确认日志文件创建成功后,将数据库切换到open状态。
SQL> startup nomount
ORACLE instance started.
Total System Global Area 941600768 bytes
Fixed Size 1348860 bytes
Variable Size 515902212 bytes
Database Buffers 419430400 bytes
Redo Buffers 4919296 bytes
SQL> alter database mount;
Database altered.
SQL> select group#,sequence#,archived,status from v$log;
GROUP# SEQUENCE# ARC STATUS
---------- ---------- --- ----------------
1 7 NO INACTIVE
3 6 NO INACTIVE
2 8 NO CURRENT
SQL>
SQL>
SQL>
SQL>
SQL> alter database clear logfile group 1;
Database altered.
SQL> select group#,sequence#,archived,status from v$log;
GROUP# SEQUENCE# ARC STATUS
---------- ---------- --- ----------------
1 0 NO UNUSED
3 6 NO INACTIVE
2 8 NO CURRENT
启动数据库到open状态
SQL>
SQL> alter database open;
Database altered.
SQL>
SQL> select group#,sequence#,archived,status from v$log;
GROUP# SEQUENCE# ARC STATUS
---------- ---------- --- ----------------
1 0 NO UNUSED
2 8 NO CURRENT
3 6 NO INACTIVE
此时我们再次查看文件列表,结果如下。
[oracle@hoegh HOEGH]$ ls
control01.ctl control02.ctl example01.dbf redo01.log redo02.log redo03.log sysaux01.dbf system01.dbf temp01.dbf undotbs01.dbf users01.dbf
[oracle@hoegh HOEGH]$
5.手动切换重做日志文件组
为了确保新建的日志文件组可用,我们可以手动切换日志文件组,改变新建日志文件组的状态(由UNUSED改为其他)。
SQL>
SQL> alter system switch logfile;
System altered.
SQL> select group#,sequence#,archived,status from v$log;
GROUP# SEQUENCE# ARC STATUS
---------- ---------- --- ----------------
1 9 NO CURRENT
2 8 NO ACTIVE
3 6 NO INACTIVE
SQL> alter system switch logfile;
System altered.
SQL> select group#,sequence#,archived,status from v$log;
GROUP# SEQUENCE# ARC STATUS
---------- ---------- --- ----------------
1 9 NO ACTIVE
2 8 NO ACTIVE
3 10 NO CURRENT
SQL> alter system switch logfile;
System altered.
SQL> select group#,sequence#,archived,status from v$log;
GROUP# SEQUENCE# ARC STATUS
---------- ---------- --- ----------------
1 9 NO INACTIVE
2 11 NO CURRENT
3 10 NO INACTIVE
SQL>
其中,
current:表示该日志组为当前日志组,oracle正在使用该日志组;
active:当current redo组发生日志切换时,状态会改变为active,在这个状态下,如果数据库为归档模式,archive进程会归档active日志组;如果发生数据库crash,该日志组也是实例恢复必需的日志组;
inactive:当active日志组归档完毕并且oracle判断不需要进行实例恢复时,会将其状态修改为inactive,等待下一轮的使用;所以当日志组为inactive的时候,如果数据库为归档模式.那么日志肯定是归档完成了。