未归档的活动在线日志损坏,在线修复。

                           i.             SQL> truncate table t1;
表已截掉。
SQL> insert into t1
  2    select dbms_flashback.get_system_change_number
  3      from (select rownum from dba_objects where rownum <= 1000) a,
  4           (select rownum from dba_objects where rownum <= 1000) b;
已创建1000000行。
SQL> commit;
提交完成。

                         ii.             SQL> SELECT GROUP#,BYTES,ARCHIVED,FIRST_CHANGE#,SEQUENCE#,STATUS FROM V$LOG;
          GROUP#            BYTES ARC    FIRST_CHANGE#        SEQUENCE# STATUS            ---------------- ---------------- --- ---------------- ---------------- ----------------                                   1         10485760 NO          2440828                2 ACTIVE                                                    2         10485760 NO          2440895                3 CURRENT                                             3         10485760 NO          2421003                1 INACTIVE    

SQL> select min(scn) ,max(scn) from t1;

   MIN(SCN)         MAX(SCN)
---------------- ----------------
         2440784          2440909
已选择 1 行。

SQL> select GROUP#,substr(member,1,60) from v$logfile;
   GROUP# SUBSTR(MEMBER,1,60)                                                                                  

 ---------------- -----------------------------
               3 D:\REDO03.LOG                                                                                                              2 D:\REDO02.LOG                                                                                                               1 D:\REDO01.LOG 

                        iii.             破坏D:\REDO01.LOG   

                        iv.             SQL> select min(scn) ,max(scn) from t1;
MIN(SCN)   MAX(SCN)
---------- ----------
2440784    2440909(日志删除,仍可查询到数据信息,内存中查的,日志和数据无关!)

                         v.             SQL> alter system checkpoint;
系统已更改。(写脏块和检查点队列 LRUW链表等有关,实际原理就是让数据文件检查点前进,越过坏掉日志的这段范围,进入安全期内,之后要做全备)

                        vi.             SQL> select substr(name, 1, 40) dname, CHECKPOINT_CHANGE#,LAST_CHANGE# ,OFFLINE_CHANGE#,status from v$datafile;
DNAME                                    CHECKPOINT_CHANGE#     LAST_CHANGE#  OFFLINE_CHANGE# STATUS                                                                                
---------------------------------------- ------------------ ---------------- ---------------- -------          D:\ORADATA\NEWDB\SYSTEM01.DBF                       2464297          2464297          2421002 SYSTEM                                                                                
D:\ORADATA\NEWDB\UNDOTBS01.DBF                      2464297          2464297          2421002 ONLINE                                                                                
C:\ORADATA\NEWDB\CWMLITE01.DBF                      2464297          2464297          2421002 ONLINE                                                                                
D:\ORADATA\NEWDB\DRSYS01.DBF                        2464297          2464297          2421002 ONLINE                                                                                
D:\ORADATA\NEWDB\EXAMPLE01.DBF                      2464297          2464297          2421002 ONLINE                                                                                
D:\ORADATA\NEWDB\INDX01.DBF                         2464297          2464297          2421002 ONLINE                                                                                
D:\ORADATA\NEWDB\ODM01.DBF                          2464297          2464297          2421002 ONLINE                                                                                
D:\ORADATA\NEWDB\TOOLS01.DBF                        2464297          2464297          2421002 ONLINE                                                                                
D:\ORADATA\NEWDB\USERS01.DBF                        2464297          2464297          2421002 ONLINE                                                                                
D:\ORADATA\NEWDB\XDB01.DBF                          2464297          2464297          2421002 ONLINE                                                                                
D:\ORADATA\NEWDB\USERS02.DBF                        2464297          2464297          2421002 ONLINE                                                                                
D:\TBS01_1.DBF                                      2464297          2464297          2421002 ONLINE                                                                                
D:\TBS01_2.DBF                                      2464297          2464297          2421002 ONLINE  

                      vii.             SQL> SELECT GROUP#,BYTES,ARCHIVED,FIRST_CHANGE#,SEQUENCE#,STATUS FROM V$LOG
GROUP#      BYTES ARC FIRST_CHANGE#  SEQUENCE# STATUS
---------- ---------- --- ------------- ---------- ----------------
         1   10485760 NO        2440828          2 ACTIVE
         2   10485760 NO        2440895          3 CURRENT
         3   10485760 NO        2421003          1 INACTIVE

                     viii.             SQL> alter system switch logfile;
系统已更改。

                        ix.             SQL> /
alter system switch logfile
*ERROR 位于第 1 行:
ORA-03113: 通信通道的文件结束
Fri Jul 10 15:09:31 2009
Errors in file e:\oracle\admin\newdb\bdump\newdb_lgwr_1928.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: 'D:\REDO01.LOG'
ORA-27047: unable to read the header block of file
OSD-04006: ReadFile() 失败, 无法读

(我们切2次,CURRENT从组2到组3,再到组1的时候,由于组1的文件损坏,所以数据库DOWN了----9i,10g的数据库时直接hang住)

总结:一般在线日志损坏的话,都要在数据库open的时候解决,不要让数据库shutdown了,在进行修复。一般要及时查看alert日志报错的信息。

                         x.             以下为数据库down情况:

                        xi.             SQL> startup
ORACLE 例程已经启动。
Total System Global Area  135338868 bytes
Fixed Size                   453492 bytes
Variable Size             109051904 bytes
Database Buffers           25165824 bytes
Redo Buffers                 667648 bytes
数据库装载完毕。
ORA-00313: 无法打开日志组 1 (线程 1) 的成员
ORA-00312: 联机日志 1 线程 1: 'D:\REDO01.LOG'

SQL> SELECT GROUP#,BYTES,ARCHIVED,FIRST_CHANGE#,SEQUENCE#,STATUS FROM V$LOG;
    GROUP#      BYTES ARC FIRST_CHANGE#  SEQUENCE# STATUS
---------- ---------- --- ------------- ---------- ----------------
         1   10485760 NO              0          0 UNUSED
         2   10485760 NO        2440895          3 INACTIVE
         3   10485760 NO        2444296          4 INVALIDATED  (我们看到4没有被归档,组1的日志再不是活动日志了)

                      xii.             SQL> alter database clear logfile group 1;
数据库已更改。

                     xiii.             SQL> alter database open;
数据库已更改。

                     xiv.             恢复完成!


你可能感兴趣的:(未归档的活动在线日志损坏,在线修复。)