資料庫恢復從ora-01152錯誤開始一路問題解決過程

darren__chan發表於2015-08-19
做一個資料庫的恢復,客戶指定恢復7月1日的,檢視了集中備份裡的剛好最早的備份是7月1日,而後一次備份是7月18日。
照常恢復控制檔案,然後restore database,recover database;

期間沒有相應的檔案系統,建了檔案系統,後來空間不夠叫sa增加了空間。
                                                                                                           

點選(此處)摺疊或開啟

  1. #mkdir /oradata
  2. #mklv -t jfs2 -y lv_oradata datavg 1022G
  3. #crfs -v jfs2 -d lv_oradata -A yes -m
  4. #mount /oradata
  5. #df -g
    
restore database結束,進行recover database 提示 
RMAN-06025 no backup of log thread 1 seq 40438 lowscn 5480793347 found to restore

alter database open resetlogs 提示
ora-01152: file 1 was not restored from a sufficiently old backup

這是無論怎麼起都提示以上錯誤,其實解決很簡單
這是可以將  40438日誌取下來做recover,但很不巧該日誌丟失了;


於是想到了修改隱含引數 _allow_resetlogs_corruption,跳過一致性檢測。
於是:
                        
                                                                                   
                                                                                                                      
                                                                                                                                                                                  
alter system set "_allow_resetlogs_corruption"=true scope=spfile;

alter database open resetlogs;
(PS:這期間因redo日誌路徑的問題出現錯誤,於是進行清除redo,然後重建)                                                                                                 )
alter database open;

資料庫直接關閉,alert 日誌提示以下內容:                               
  1. Wed Aug 19 09:12:50 BEIST 2015
  2. ORA-01555 caused by SQL statement below (SQL ID: 4krwuz0ctqxdt, SCN: 0x0001.46b0aa96):
  3. Wed Aug 19 09:12:50 BEIST 2015
  4. select ctime, mtime, stime from obj$ where obj# = :1
  5. Wed Aug 19 09:12:50 BEIST 2015
  6. Errors in file /opt/app/oracle/products/10205/rdbms/log/gessdb_ora_13959238.trc:
  7. ORA-00704: bootstrap process failure
  8. ORA-00704: bootstrap process failure
  9. ORA-00604: error occurred at recursive SQL level 1
  10. ORA-01555: snapshot too old: rollback segment number 6 with name "_SYSSMU6$" too small
  11. Error 704 happened during db open, shutting down database
  12. USER: terminating instance due to error 704
  13. Instance terminated by USER, pid = 13959238
  14. ORA-1092 signalled during: ALTER DATABASE OPEN..
資料庫啟動時  執行   select ctime, mtime, stime from obj$ where obj# = :1 導致快照太舊;因而bootstrap程式失敗,於是透過了oradebug 推進scn的方法來解決;
以下部落格有相應實驗過程:                              
                 
資料庫open報錯ora-01555-snapshot-too-old.html

oradebug 過程:
  1. SQL> oradebug setmypid
  2. Statement processed.
  3. SQL>
  4. SQL> oradebug dumpvar sga kcsgscn_kcslff
  5. ORA-00079: variable kcsgscn_kcslf not found
  6. SQL> oradebug 0x700000010012650 4 0x146BFECD3
  7. ORA-00070: command 0x700000010012650 is not valid
  8. SQL> oradebug dumpvar sga kcsgscn_
  9. kcslf kcsgscn_ [700000010012650, 700000010012680) = 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 07000000 ...
  10. SQL> oradebug poke 0x700000010012650 4 0x146BFECD3
  11. BEFORE: [700000010012650, 700000010012654) = 00000000
  12. AFTER: [700000010012650, 700000010012654) = 46BFECD3
  13. SQL>
  14. SQL>
 oradebug addr length value   value是推進後的scn;
  這裡簡單解釋一下,4 為長度,0x146BFECD3是16進位制,我在原來的v$datafile_header.checkpoint_change#的基礎之上
加上上1000000得到該值。                  

其實執行alter database open;
資料庫報錯,alert 日誌如下:
ora-600      [2252], [60627],錯誤應該是由於推進了scn導致時間不對導致,此時可以重啟資料庫。
                                                                                
                                                           

  1. ARC1 started with pid=21, OS id=9437196
  2. Wed Aug 19 09:55:54 BEIST 2015
  3. Errors in file /opt/app/oracle/products/10205/rdbms/log/gessdb_lgwr_12583110.trc:
  4. ORA-00600: internal error code, arguments: [2252], [60627], [1], [], [], [], [], []
  5. Wed Aug 19 09:55:55 BEIST 2015
  6. Errors in file /opt/app/oracle/products/10205/rdbms/log/gessdb_lgwr_12583110.trc:
  7. ORA-00600: internal error code, arguments: [2252], [60627], [1], [], [], [], [], []
  8. Wed Aug 19 09:55:55 BEIST 2015
  9. LGWR: terminating instance due to error 470
  10. Instance terminated by LGWR, pid = 125831
於是我再重啟資料庫,alert 日誌報了以下內容                  

  1. Wed Aug 19 09:59:18 BEIST 2015
  2. Errors in file /opt/app/oracle/products/10205/rdbms/log/gessdb_ora_12582916.trc:
  3. ORA-00704: bootstrap process failure
  4. ORA-39700: database must be opened with UPGRADE option
  5. Wed Aug 19 09:59:18 BEIST 2015
  6. Error 704 happened during db open, shutting down database
  7. USER: terminating instance due to error 704
  8. Instance terminated by USER, pid = 12582916
  9. ORA-1092 signalled during: alter database open...
此時報ORA-39700資料庫需以upgrade 啟動。於是已upgrade 做了升級。                              


  1. shutdown immediate
  2. startup upgrade

  3. @?/rdbms/admin/catupgrd.sql
  4. @?/rdbms/admin/catalog.sql
  5. @?/rdbms/admin/catproc.sql
  6. @?/rdbms/admin/utlrp.sql

shutdown immediate

SQL> startup
ORACLE instance started.
Total System Global Area 1224736768 bytes
Fixed Size                  2096032 bytes
Variable Size             335545440 bytes
Database Buffers          872415232 bytes
Redo Buffers               14680064 bytes
Database mounted.
Database opened.


將 _allow_resetlogs_corruption改為false。                 
alter system set "_allow_resetlogs_corruption"=false  scope=spfile;
shutdown immediate
SQL> startup

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29863023/viewspace-1776522/,如需轉載,請註明出處,否則將追究法律責任。

相關文章