sqlplus以管理員方式接入
數據庫,啟動時出現報錯,如下:
> sqlplus "/as sysdba"
SQL> startup
......
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: '/tmp/test.dbf'
查看數據庫日志文件alert_$ORACLE_SID.log,存在對應報錯信息:
Errors in file ....../aix85_psp0_454886.trc:
查看此trc文件中記錄信息:
*** SERVICE NAME:() 2011-07-18 10:05:00.769
*** SESSION ID:(332.1) 2011-07-18 10:05:00.769
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: '/tmp/test.dbf'
ORA-27037: unable to obtain file status
IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 3
ORA-01157: cannot identify/lock data file 9 - see DBWR trace file
ORA-01110: data file 9: '/tmp/test1.dbf'
ORA-27037: unable to obtain file status
IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 3
ORA-01157: cannot identify/lock data file 10 - see DBWR trace file
ORA-01110: data file 10: '/tmp/indx1.dbf'
ORA-27037: unable to obtain file status
IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 3
ORA-01157: cannot identify/lock data file 11 - see DBWR trace file
ORA-01110: data file 11: '/tmp/test2.dbf'
ORA-27037: unable to obtain file status
IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 3
ORA-01157: cannot identify/lock data file 12 - see DBWR trace file
查詢分析:
查看/tmp目錄中已經沒有任何dbf文件存在,查詢確認/tmp目錄中的幾個dbf是在之前數據庫運行過程中添加的測試空間文件,測試完畢已經刪除,而且后續沒有任何人訪問到這幾個文件,因此也沒有任何數據庫報錯,直到數據庫實例宕掉並重啟時出現啟動失敗。
解決辦法:
既然出現報錯的幾個dbf文件已經不用,則解決辦法相對簡單,只要將對應的數據文件刪除,並繼續刪除對應新增的表空間即可。操作過程如下:
SQL> shutdown immediate;
SQL> startup mount;
SQL> select file#,name,status from v$datafile;
SQL> alter database datafile '/tmp/test.dbf' offline drop; //此處若不加drop會報錯
再次查看v$datafile表會發現對應的幾個dbf文件狀態由ONLINE變為RECOVER
SQL> select * from v$tablespace;
SQL> drop tablespace test including contents cascade constraints;
......
刪除完畢,再次執行startup成功。