類比伺服器突然掉電,資料庫丟失,事務無法完成復原故障的恢複
資料庫的狀態如下:
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
marven OPEN
非歸檔模式:
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /u01/app/Oracle/product/10.2.0/db_1/dbs/arch
Oldest online log sequence 25
Current log sequence 27
SQL> set linesize 150 pagesize 300
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 25 52428800 1 NO CURRENT 384492 29-JAN-12
2 1 23 52428800 1 NO INACTIVE 371795 29-JAN-12
3 1 24 52428800 1 NO INACTIVE 377698 29-JAN-12
採用shutdown abort類比突然掉電,資料庫關閉的情形,此時資料庫可以正常啟動到MOUNT狀態
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2084296 bytes
Variable Size 385876536 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14692352 bytes
Database mounted.
此時日誌狀態如下:
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 25 52428800 1 NO ACTIVE 384492 29-JAN-12
3 1 27 52428800 1 NO CURRENT 391086 29-JAN-12
2 1 26 52428800 1 NO ACTIVE 389733 29-JAN-12
刪除所有的重做記錄檔:
SQL>!rm /u01/app/oracle/oradata/marven/redo*.log
SQL> shutdown abort
ORACLE instance shut down.
SQL>startup nomount
Total System Global Area 1610612736 bytes
Fixed Size 2084296 bytes
Variable Size 385876536 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14692352 bytes
SQL> alter database mount;
Database altered.
在開啟資料庫時發現無法正常開啟
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/marven/redo01.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
試圖通過resetlog開啟資料庫發現是行不通的:
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery
spfile參數檔案的目錄如下:
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/10.2.0
/db_1/dbs/spfilemarven.ora