1. 查看当前redolog组及文件情况
  2.  
  3. SQL> col member for a40; 
  4. SQL> select * from v$logfile; 
  5.  
  6.  
  7.  
  8.  
  9.     GROUP# STATUS  TYPE    MEMBER                                   IS_          
  10. ---------- ------- ------- ---------------------------------------- ---          
  11.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03.LOG        NO           
  12.          2         ONLINE  D:\ORACLE\ORADATA\TEST\REDO02.LOG        NO           
  13.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01.LOG        NO           
  14.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03_B.LOG      NO           
  15.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01_B.LOG      NO           
  16.          2         ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_B.LOG      NO           
  17.  
  18. 6 rows selected. 
  19.  
  20.  
  21. SQL> select group#, sequence#, members, status from v$log; 
  22.  
  23.     GROUP#  SEQUENCE#    MEMBERS STATUS 
  24. ---------- ---------- ---------- ---------------- 
  25.          1         66          2 INACTIVE 
  26.          2         67          2 CURRENT 
  27.          3         65          2 INACTIVE 
  28.  
  29. SQL> shutdown immediate; 
  30. Database closed. 
  31. Database dismounted. 
  32. ORACLE instance shut down. 
  33. 模拟redolog损坏
  1. SQL> host del D:\ORACLE\ORADATA\TEST\REDO02.LOG 
  2.  
  3.  SQL> host dir D:\ORACLE\ORADATA\TEST\ 驱动器 D 中的卷没有标签。 卷的序列号是 32C6-FA43 D:\ORACLE\ORADATA\TEST 的目录 2012/12/14 10:36 . 2012/12/14 10:36 .. 2012/12/14 10:34 9,781,248 CONTROL01.CTL 2012/12/14 10:34 104,865,792 EXAMPLE01.DBF 2012/12/14 10:34 52,429,312 REDO01.LOG 2012/12/14 10:34 52,429,312 REDO01_B.LOG 2012/12/14 10:34 52,429,312 REDO02_B.LOG 2012/12/14 10:34 52,429,312 REDO03.LOG 2012/12/14 10:34 52,429,312 REDO03_B.LOG 2012/12/14 10:34 660,611,072 SYSAUX01.DBF 2012/12/14 10:34 754,982,912 SYSTEM01.DBF 2012/12/14 10:34 30,416,896 TEMP01.DBF 2012/11/27 21:37 104,865,792 UNDO2_01.DBF 2012/12/14 10:34 167,780,352 UNDOTBS01.DBF 2012/12/14 10:34 140,255,232 USERS01.DBF 13 个文件 2,235,705,856 字节 2 个目录 41,113,239,552 可用字节
  4.  
  5. SQL> startup; 
  6. ORACLE instance started. 
  7.  
  8. Total System Global Area 1933430784 bytes                                        
  9. Fixed Size                  1378680 bytes                                        
  10. Variable Size             452986504 bytes                                        
  11. Database Buffers         1468006400 bytes                                        
  12. Redo Buffers               11059200 bytes                                        
  13. Database mounted. 
  14. Database opened. 

系统报错,找不到redolog成员;

 

模拟redolog损坏,删除损坏并添加新的redolog_第1张图片


em中报错,alter 日志报错;
 

    
    
    
    
  1. Thread 1 advanced to log sequence 68 (LGWR switch) 
  2.   Current log# 3 seq# 68 mem# 0: D:\ORACLE\ORADATA\TEST\REDO03.LOG 
  3.   Current log# 3 seq# 68 mem# 1: D:\ORACLE\ORADATA\TEST\REDO03_B.LOG 
  4. Fri Dec 14 10:38:06 2012 
  5. Errors in file d:\oracle\diag\rdbms\test\test\trace\test_arc0_2356.trc: 
  6. ORA-00313: open failed for members of log group 2 of thread 1 
  7. Errors in file d:\oracle\diag\rdbms\test\test\trace\test_arc0_2356.trc: 
  8. ORA-00313: open failed for members of log group 2 of thread 1 
  9. Fri Dec 14 10:38:06 2012 
  10. Errors in file d:\oracle\diag\rdbms\test\test\trace\test_m000_6140.trc: 
  11. ORA-00313: open failed for members of log group 2 of thread 1 
  12. ORA-00312: online log 2 thread 1: 'D:\ORACLE\ORADATA\TEST\REDO02.LOG' 
  13. ORA-27041: unable to open file 
  14. OSD-04002: unable to open file 
  15. O/S-Error: (OS 2) 系统找不到指定的文件。 
  16. Archived Log entry 61 added for thread 1 sequence 67 ID 0x7d0ee5dc dest 1: 

 返回sqlplus;

   
   
   
   
  1. SQL> select * from v$log; 
  2.  
  3.     GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC            
  4. ---------- ---------- ---------- ---------- ---------- ---------- ---            
  5. STATUS           FIRST_CHANGE# FIRST_TIME   NEXT_CHANGE# NEXT_TIME               
  6. ---------------- ------------- ------------ ------------ ------------            
  7.          1          1         66   52428800        512          2 YES            
  8. INACTIVE               2098256 13-DEC-12         2098259 13-DEC-12               
  9.                                                                                  
  10.          2          1         67   52428800        512          2 NO             
  11. CURRENT                2098259 13-DEC-12      2.8147E+14                         
  12.                                                                                  
  13.          3          1         65   52428800        512          2 YES            
  14. INACTIVE               2098093 13-DEC-12         2098256 13-DEC-12               
  15.                                                                                  
  16.  
  17. SQL> select group#, sequence#, members, archived, status from v$log; 
  18.  
  19.     GROUP#  SEQUENCE#    MEMBERS ARC STATUS                                      
  20. ---------- ---------- ---------- --- ----------------                            
  21.          1         66          2 YES INACTIVE                                    
  22.          2         67          2 NO  CURRENT                                     
  23.          3         65          2 YES INACTIVE                                    
  24.  
  25. SQL> alter system switch logfile; 
  26.  
  27. System altered. 
  28.  
  29. SQL> select group#, sequence#, members, archived, status from v$log; 
  30.  
  31.     GROUP#  SEQUENCE#    MEMBERS ARC STATUS                                      
  32. ---------- ---------- ---------- --- ----------------                            
  33.          1         66          2 YES INACTIVE                                    
  34.          2         67          2 YES ACTIVE                                      
  35.          3         68          2 NO  CURRENT                                     
  36.  
  37. SQL> alter system checkpoint; 
  38.  
  39. System altered. 
  40.  
  41. SQL> select group#, sequence#, members, archived, status from v$log; 
  42.  
  43.     GROUP#  SEQUENCE#    MEMBERS ARC STATUS                                      
  44. ---------- ---------- ---------- --- ----------------                            
  45.          1         66          2 YES INACTIVE                                    
  46.          2         67          2 YES INACTIVE                                    
  47.          3         68          2 NO  CURRENT                                     
  48.  
  49. SQL> select * from v$logfile; 
  50.  
  51.     GROUP# STATUS  TYPE    MEMBER                                   IS_          
  52. ---------- ------- ------- ---------------------------------------- ---          
  53.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03.LOG        NO           
  54.          2 INVALID ONLINE  D:\ORACLE\ORADATA\TEST\REDO02.LOG        NO           
  55.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01.LOG        NO           
  56.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03_B.LOG      NO           
  57.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01_B.LOG      NO           
  58.          2         ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_B.LOG      NO           
  59.  
  60. 6 rows selected. 

删除错误的redolog成员,或者使用“alter database clear logfile group 3;”类似的命令清除即可;参考

 

  1.  
  2. SQL> alter database drop logfile member 'D:\ORACLE\ORADATA\TEST\REDO02.LOG'; 
  3.  
  4. Database altered. 
  5.  
  6. SQL> select * from v$logfile; 
  7.  
  8.     GROUP# STATUS  TYPE    MEMBER                                   IS_          
  9. ---------- ------- ------- ---------------------------------------- ---          
  10.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03.LOG        NO           
  11.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01.LOG        NO           
  12.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03_B.LOG      NO           
  13.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01_B.LOG      NO           
  14.          2         ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_B.LOG      NO           
  15.  
  16. SQL> alter system switch logfile; 
  17.  
  18. System altered. 
  19.  
  20. SQL> select group#, sequence#, members, archived, status from v$log; 
  21.  
  22.     GROUP#  SEQUENCE#    MEMBERS ARC STATUS                                      
  23. ---------- ---------- ---------- --- ----------------                            
  24.          1         69          2 NO  CURRENT                                     
  25.          2         67          1 YES INACTIVE                                    
  26.          3         68          2 YES ACTIVE                                      

添加新的redolog成员

  1. SQL> alter database add logfile member 'D:\ORACLE\ORADATA\TEST\REDO02_new.LOG' to group 2; 
  2.  
  3. Database altered. 
  4.  
  5. SQL> alter system switch logfile; 
  6.  
  7. System altered. 
  8.  
  9. SQL> select * from v$logfile; 
  10.  
  11.     GROUP# STATUS  TYPE    MEMBER                                   IS_          
  12. ---------- ------- ------- ---------------------------------------- ---          
  13.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03.LOG        NO           
  14.          2         ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_NEW.LOG    NO           
  15.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01.LOG        NO           
  16.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03_B.LOG      NO           
  17.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01_B.LOG      NO           
  18.          2         ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_B.LOG      NO           
  19.  
  20. 6 rows selected. 
  21.  
  22. SQL> select group#, sequence#, members, archived, status from v$log; 
  23.  
  24.     GROUP#  SEQUENCE#    MEMBERS ARC STATUS                                      
  25. ---------- ---------- ---------- --- ----------------                            
  26.          1         69          2 YES ACTIVE                                      
  27.          2         70          2 NO  CURRENT                                     
  28.          3         68          2 YES ACTIVE                                      
  29.  
  30. SQL> alter system checkpoint; 
  31.  
  32. System altered. 
  33.  
  34. SQL> select group#, sequence#, members, archived, status from v$log; 
  35.  
  36.     GROUP#  SEQUENCE#    MEMBERS ARC STATUS                                      
  37. ---------- ---------- ---------- --- ----------------                            
  38.          1         69          2 YES INACTIVE                                    
  39.          2         70          2 NO  CURRENT                                     
  40.          3         68          2 YES INACTIVE                                    
  41.  
  42. SQL> spool off