清除失败的redolog

 

  
  
  
  
  1. SQL> select * from v$logfile; 
  2.  
  3.     GROUP# STATUS  TYPE    MEMBER                                   IS_          
  4. ---------- ------- ------- ---------------------------------------- ---          
  5.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03.LOG        NO           
  6.          2         ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_NEW.LOG    NO           
  7.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01.LOG        NO           
  8.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03_B.LOG      NO           
  9.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01_B.LOG      NO           
  10.          2         ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_B.LOG      NO           
  11.  
  12. 6 rows selected. 
  13.  
  14. SQL> select group#, sequence#, members, archived, status from v$log; 
  15.  
  16.     GROUP#  SEQUENCE#    MEMBERS ARC STATUS                                      
  17. ---------- ---------- ---------- --- ----------------                            
  18.          1         69          2 YES INACTIVE                                    
  19.          2         70          2 NO  CURRENT                                     
  20.          3          0          2 YES UNUSED                                      
  21.  
  22. SQL> shutdown immediate; 
  23. Database closed. 
  24. Database dismounted. 
  25. ORACLE instance shut down. 
  26. SQL> host del D:\ORACLE\ORADATA\TEST\REDO02_NEW.LOG; 
  27.  
  28. SQL> host dir D:\ORACLE\ORADATA\TEST\ 
  29.  
  30. SQL> startup; 
  31. ORACLE instance started. 
  32.  
  33. Total System Global Area 1933430784 bytes                                        
  34. Fixed Size                  1378680 bytes                                        
  35. Variable Size             452986504 bytes                                        
  36. Database Buffers         1468006400 bytes                                        
  37. Redo Buffers               11059200 bytes                                        
  38. Database mounted. 
  39. Database opened. 
  40. SQL> select * from v$logfile; 
  41.  
  42.     GROUP# STATUS  TYPE    MEMBER                                   IS_          
  43. ---------- ------- ------- ---------------------------------------- ---          
  44.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03.LOG        NO           
  45.          2 INVALID ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_NEW.LOG    NO           
  46.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01.LOG        NO           
  47.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03_B.LOG      NO           
  48.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01_B.LOG      NO           
  49.          2         ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_B.LOG      NO           
  50.  
  51. 6 rows selected. 

找到包含失败的redolog;

  1.  
  2. SQL> alter system switch logfile; 
  3.  
  4. System altered. 
  5.  
  6. SQL> alter system checkpoint; 
  7.  
  8. System altered. 
  9.  
  10. SQL> select * from v$logfile; 
  11.  
  12.     GROUP# STATUS  TYPE    MEMBER                                   IS_          
  13. ---------- ------- ------- ---------------------------------------- ---          
  14.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03.LOG        NO           
  15.          2 INVALID ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_NEW.LOG    NO           
  16.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01.LOG        NO           
  17.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03_B.LOG      NO           
  18.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01_B.LOG      NO           
  19.          2         ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_B.LOG      NO           
  20.  
  21. 6 rows selected. 
  22.  
  23. SQL> select group#, sequence#, members, archived, status from v$log; 
  24.  
  25.     GROUP#  SEQUENCE#    MEMBERS ARC STATUS                                      
  26. ---------- ---------- ---------- --- ----------------                            
  27.          1         69          2 YES INACTIVE                                    
  28.          2         70          2 YES INACTIVE                                    
  29.          3         71          2 NO  CURRENT     
  30.  
  31. 清除包含失败的logfile的log组2                                
  32.  
  33. SQL> alter database test clear logfile group 2; 
  34.  
  35. Database altered. 
  36.  
  37. SQL> select * from v$logfile; 
  38.  
  39.     GROUP# STATUS  TYPE    MEMBER                                   IS_          
  40. ---------- ------- ------- ---------------------------------------- ---          
  41.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03.LOG        NO           
  42.          2         ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_NEW.LOG    NO           
  43.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01.LOG        NO           
  44.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03_B.LOG      NO           
  45.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01_B.LOG      NO           
  46.          2         ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_B.LOG      NO           
  47.  
  48. 6 rows selected. 
  49.  
  50. SQL> select group#, sequence#, members, archived, status from v$log; 
  51.  
  52.     GROUP#  SEQUENCE#    MEMBERS ARC STATUS                                      
  53. ---------- ---------- ---------- --- ----------------                            
  54.          1         69          2 YES INACTIVE                                    
  55.          2          0          2 YES UNUSED                                      
  56.          3         71          2 NO  CURRENT                                     
  57.  
  58. SQL> alter system switch logfile; 
  59.  
  60. System altered. 
  61.  
  62. SQL> alter system switch logfile; 
  63.  
  64. System altered. 
  65.  
  66. SQL> alter system checkpoint; 
  67.  
  68. System altered. 
  69.  
  70. SQL> select group#, sequence#, members, archived, status from v$log; 
  71.  
  72.     GROUP#  SEQUENCE#    MEMBERS ARC STATUS                                      
  73. ---------- ---------- ---------- --- ----------------                            
  74.          1         73          2 NO  CURRENT                                     
  75.          2         72          2 YES INACTIVE                                    
  76.          3         71          2 YES INACTIVE                                    
  77.  
  78. SQL> alter system switch logfile; 
  79.  
  80. System altered. 
  81.  
  82. SQL> alter system checkpoint; 
  83.  
  84. System altered. 
  85.  
  86. SQL> select group#, sequence#, members, archived, status from v$log; 
  87.  
  88.     GROUP#  SEQUENCE#    MEMBERS ARC STATUS                                      
  89. ---------- ---------- ---------- --- ----------------                            
  90.          1         73          2 YES INACTIVE                                    
  91.          2         72          2 YES INACTIVE                                    
  92.          3         74          2 NO  CURRENT                                     
  93.  
  94. SQL> select * from v$logfile; 
  95.  
  96.     GROUP# STATUS  TYPE    MEMBER                                   IS_          
  97. ---------- ------- ------- ---------------------------------------- ---          
  98.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03.LOG        NO           
  99.          2         ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_NEW.LOG    NO           
  100.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01.LOG        NO           
  101.          3         ONLINE  D:\ORACLE\ORADATA\TEST\REDO03_B.LOG      NO           
  102.          1         ONLINE  D:\ORACLE\ORADATA\TEST\REDO01_B.LOG      NO           
  103.          2         ONLINE  D:\ORACLE\ORADATA\TEST\REDO02_B.LOG      NO           
  104.  
  105. 6 rows selected. 
  106.  
  107. SQL> spool off 

 

你可能感兴趣的:(redolog)