在突然斷電後重啓數據庫 如果數據庫業務邏輯處理頻繁,往往引發錯誤。有簡單的數據文件壞塊,有些會引起內核錯誤,一般通過redo日誌恢復都可以恢復正常狀態
錯誤例子一:需要恢復數據文件
重新啓動出現 ora-01172,ora-01151錯誤
SQL> startup
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2220200 bytes
Variable Size 817893208 bytes
Database Buffers 243269632 bytes
Redo Buffers 5554176 bytes
Database mounted.
ORA-01172: recovery of thread 1 stuck at block 208 of file 3
ORA-01151: use media recovery to recover block, restore backup if needed
查看ora-01172錯誤描述
oerr ora 01172
[oracle@localhost ~]$ oerr ora 01172
01172, 00000, "recovery of thread %s stuck at block %s of file %s"
// *Cause: Crash recovery or instance recovery could not apply a change to a
// block because it was not the next change. This can happen if the
// block was corrupted and then repaired during recovery.
// *Action: Do a RECOVER DATAFILE for the file containing the block. If this
// does not resolve the problem then restore the file from a backup
// and recover it.
[oracle@localhost ~]$ sqlplus / as sysdba
SQL> recover datafile 3;
Media recovery complete.
SQL> alter database open;
Database altered.
SQL> select name,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
ORCL READ WRITE
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
錯誤例子二:引起看不到的內核錯誤
重啓出現 ORA-00600: internal error code, arguments: [kcratr_scan_lastbwr], [], [], [], [], [], [], [], [], [], [], []
ALTER DATABASE RECOVER database
Media Recovery Start
started logmerger process
Parallel Media Recovery started with 2 slaves
Thu Mar 13 10:51:51 2014
Recovery of Online Redo Log: Thread 1 Group 3 Seq 2937 Reading mem 0
Mem# 0: /home/oracle/oradata/orcl/redo03.log
Media Recovery Complete (orcl)
Completed: ALTER DATABASE RECOVER database
alter database open