Oracle日志文件被误删除导致的问题解决(ora-01033,ORA-00313,ORA-00312)!

由于使用了一个未经验证的清除垃圾文件的程序,导致Oracle数据库的两个日志文件被非法删除(Redo01,Redo02),导致Oracle无法连接(能启动),系统报错:
           ora-01033:oracle initializationg or shutdown in progress
最开始知道问题是由于文件被误删导致的,但不知道是日志文件被删除,由于数据库应用能启动,因此决定做一次 recover操作,步骤如下:
          步骤1:    sqlplus /NOLOG

                                SQL*Plus: Release 9.2.0.1.0 - Production on 星期一 5月 12 09:12:59 2008

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

          步骤2:      SQL> connect sys/password as sysdba
                                已连接。
          步骤3:       SQL> shutdown normal
                                ORA-01109: 数据库未打开


                                已经卸载数据库。
                                ORACLE 例程已经关闭。
          步骤3:       SQL> startup mount
                                ORACLE 例程已经启动。

                                Total System Global Area  135338868 bytes
                                Fixed Size                   453492 bytes
                                Variable Size             109051904 bytes
                                Database Buffers           25165824 bytes
                                Redo Buffers                 667648 bytes
                                数据库装载完毕。
          步骤4:      SQL> alter database open;
                                alter database open
                                 *
                                ERROR 位于第 1 行:
                                ORA-00313: 无法打开日志组 1 (线程 1) 的成员
                                ORA-00312: 联机日志 1 线程 1: 'C:/ORACLE/ORADATA/NIDB/REDO01.LOG'
在操作步骤4时,发现报ORA-00313,00312错误,检查应用实例目录下,发现只剩下REDO03.LOG文件,问题到此已经明朗化,首先,执行下面的语句看看group1是不是current日志组
          步骤5:      SQL> select group#,sequence#,archived,status from v$log;
                                        GROUP#  SEQUENCE# ARC STATUS
                               ---------- ---------- --- ----------------
                                                      1        134 NO  INACTIVE
                                                      2        135 NO  INACTIVE
                                                      3        136 NO  INVALIDATED

可以发现,被删除的日志不是当前日志组的成员,解决就比较简单 了:
          步骤6:       SQL> alter database clear logfile group 1;

                                数据库已更改。

                                SQL> alter database open;
                                alter database open
                                 *
                                ERROR 位于第 1 行:
                                ORA-00313: 无法打开日志组 2 (线程 1) 的成员
                                ORA-00312: 联机日志 2 线程 1: 'C:/ORACLE/ORADATA/NIDB/REDO02.LOG'

注意:如果你的库是非归档的,或许要用下面的语句
                            alter database clear unarchived logfile group 1;
现在提示REDO02.LOG文件也被有问题,继续步骤5、6
          步骤7:       SQL> select group#,sequence#,archived,status from v$log;

                                      GROUP#  SEQUENCE# ARC STATUS
                                 ---------- ---------- --- ----------------
                                                    1          0 NO  UNUSED
                                                    2        135 NO  INACTIVE
                                                    3        136 NO  INVALIDATED

                                 SQL> alter database clear logfile group 2;

                                 数据库已更改。

          步骤8:         SQL> select group#,sequence#,archived,status from v$log;

                                         GROUP#  SEQUENCE# ARC STATUS
                                  ---------- ---------- --- ----------------
                                                       1          0 NO  UNUSED
                                                       2          0 NO  UNUSED
                                                       3        136 NO  INVALIDATED

在做一遍数据库打开操作:
          步骤9:         SQL> alter database open;

                                   数据库已更改。
好了,不报错了,在重新登陆数据库,顺利进入,问题解决!再次检查应用实例目录下,发现已经重建REDO01.LOG、REDO02.LOG两个文件

   

你可能感兴趣的:(oracle,sql,c,数据库,database,System)