ORA-01157&ORA-01110故障解決

Hoegh發表於2015-07-08
        今天在啟動虛擬機器測試庫時,資料庫報了ORA-01157和ORA-01110錯誤,提示找不到一個資料檔案。我一看檔名就知道問題在哪兒了,是另一臺虛擬機器沒有啟動導致的,因為這個資料庫透過dnfs建立了一個“遠端”表空間。由於暫時不想啟動那臺虛擬機器(節省記憶體),乾脆就把這個表空間刪除,熟悉一下trouble-shooting的過程。

1.環境準備

我們在Oracle11g中進行測試。

點選(此處)摺疊或開啟

  1. SQL> 
  2. SQL> select * from v$version;

  3. BANNER
  4. --------------------------------------------------------------------------------
  5. Oracle Database 11g Enterprise Edition Release 11.2.0.3.- Production
  6. PL/SQL Release 11.2.0.3.- Production
  7. CORE 11.2.0.3.0 Production
  8. TNS for Linux: Version 11.2.0.3.- Production
  9. NLSRTL Version 11.2.0.3.- Production

  10. SQL>

2.啟動資料庫報錯

在啟動資料庫過程中,報了ORA-01157和ORA-01110錯誤,提示找不到資料檔案。

點選(此處)摺疊或開啟

  1. SYS@HOEGH>startup
  2. ORACLE instance started.

  3. Total System Global Area 941600768 bytes
  4. Fixed Size 1348860 bytes
  5. Variable Size 524290820 bytes
  6. Database Buffers 411041792 bytes
  7. Redo Buffers 4919296 bytes
  8. Database mounted.
  9. ORA-01157: cannot identify/lock data file 9 - see DBWR trace file
  10. ORA-01110: data file 9: \'/u02/oradata/HOEGH/test_tbs01.dbf\'


  11. SYS@HOEGH>select status from v$instance;

  12. STATUS
  13. ------------
  14. MOUNTED

  15. SYS@HOEGH>
由於另外一臺虛擬機器沒有啟動,資料庫在啟動過程中後臺程式不能找到相應的資料檔案或者不能鎖定相應的資料檔案,資料庫將禁止訪問這些資料檔案而其他的資料檔案則沒有影響。ORA-01157錯誤一般和ORA-01110錯誤一起出現。

3.重啟資料庫到mount狀態,刪除資料檔案

啟動資料庫時,nomount狀態讀取引數檔案,mount狀態讀取控制檔案,在mount狀態下可以刪除資料檔案。

點選(此處)摺疊或開啟

  1. SYS@HOEGH>
  2. SYS@HOEGH>startup nomount
  3. ORACLE instance started.

  4. Total System Global Area 941600768 bytes
  5. Fixed Size 1348860 bytes
  6. Variable Size 524290820 bytes
  7. Database Buffers 411041792 bytes
  8. Redo Buffers 4919296 bytes
  9. SYS@HOEGH>
  10. SYS@HOEGH>
  11. SYS@HOEGH>alter database mount;

  12. Database altered.

  13. SYS@HOEGH>alter database datafile \'/u02/oradata/HOEGH/test_tbs01.dbf\' offline drop;

  14. Database altered.

4.開啟資料庫,刪除表空間

啟動資料庫到open狀態,查詢資料檔案對應的表空間名稱;然後,刪除表空間。

點選(此處)摺疊或開啟

  1. SYS@HOEGH>alter database open;

  2. Database altered.

  3. SYS@HOEGH>
  4. SYS@HOEGH>select file_id,tablespace_name from dba_data_files;

  5.    FILE_ID TABLESPACE_NAME
  6. ---------- ------------------------------
  7.          4 USERS
  8.          3 UNDOTBS1
  9.          2 SYSAUX
  10.          1 SYSTEM
  11.          5 TEST1
  12.          6 TEST2
  13.          7 TEST3
  14.          8 TEST
  15.          9 TEST_TBS

  16. 9 rows selected.
  17. SYS@HOEGH>col file_name for a50
  18. SYS@HOEGH>col file_id for 99
  19. SYS@HOEGH>col tablespace_name for a10
  20. SYS@HOEGH>col status for a10
  21. SYS@HOEGH>col online_status for a20
  22. SYS@HOEGH>select file_name,file_id,TABLESPACE_NAME,STATUS,ONLINE_STATUS from dba_data_files;
  23. FILE_NAME FILE_ID TABLESPACE STATUS ONLINE_STATUS
  24. -------------------------------------------------- ------- ---------- ---------- --------------------
  25. /u01/app/oracle/oradata/HOEGH/users01.dbf 4 USERS AVAILABLE ONLINE
  26. /u01/app/oracle/oradata/HOEGH/undotbs01.dbf 3 UNDOTBS1 AVAILABLE ONLINE
  27. /u01/app/oracle/oradata/HOEGH/sysaux01.dbf 2 SYSAUX AVAILABLE ONLINE
  28. /u01/app/oracle/oradata/HOEGH/system01.dbf 1 SYSTEM AVAILABLE SYSTEM
  29. /u01/app/oracle/oradata/HOEGH/TEST101.dbf 5 TEST1 AVAILABLE ONLINE
  30. /u01/app/oracle/oradata/HOEGH/TEST201.dbf 6 TEST2 AVAILABLE ONLINE
  31. /u01/app/oracle/oradata/HOEGH/TEST301.dbf 7 TEST3 AVAILABLE ONLINE
  32. /u01/app/oracle/oradata/HOEGH/test.dbf 8 TEST AVAILABLE ONLINE
  33. /u02/oradata/HOEGH/test_tbs01.dbf 9 TEST_TBS AVAILABLE RECOVER

  34. 9 rows selected.

  35. SYS@HOEGH>drop tablespace TEST_TBS including contents;

  36. Tablespace dropped.

  37. SYS@HOEGH>
  38. SYS@HOEGH>select file_name,file_id,TABLESPACE_NAME,STATUS,ONLINE_STATUS from dba_data_files;

  39. FILE_NAME FILE_ID TABLESPACE STATUS ONLINE_STATUS
  40. -------------------------------------------------- ------- ---------- ---------- --------------------
  41. /u01/app/oracle/oradata/HOEGH/users01.dbf 4 USERS AVAILABLE ONLINE
  42. /u01/app/oracle/oradata/HOEGH/undotbs01.dbf 3 UNDOTBS1 AVAILABLE ONLINE
  43. /u01/app/oracle/oradata/HOEGH/sysaux01.dbf 2 SYSAUX AVAILABLE ONLINE
  44. /u01/app/oracle/oradata/HOEGH/system01.dbf 1 SYSTEM AVAILABLE SYSTEM
  45. /u01/app/oracle/oradata/HOEGH/TEST101.dbf 5 TEST1 AVAILABLE ONLINE
  46. /u01/app/oracle/oradata/HOEGH/TEST201.dbf 6 TEST2 AVAILABLE ONLINE
  47. /u01/app/oracle/oradata/HOEGH/TEST301.dbf 7 TEST3 AVAILABLE ONLINE
  48. /u01/app/oracle/oradata/HOEGH/test.dbf 8 TEST AVAILABLE ONLINE

  49. 8 rows selected.

  50. SYS@HOEGH>

5.重啟資料庫

在進行上述操作後,重啟資料庫,確保資料庫能夠正常開啟。

點選(此處)摺疊或開啟

  1. SYS@HOEGH>
  2. SYS@HOEGH>shut immediate
  3. Database closed.
  4. Database dismounted.
  5. ORACLE instance shut down.
  6. SYS@HOEGH>
  7. SYS@HOEGH>
  8. SYS@HOEGH>startup
  9. ORACLE instance started.

  10. Total System Global Area 941600768 bytes
  11. Fixed Size 1348860 bytes
  12. Variable Size 511707908 bytes
  13. Database Buffers 423624704 bytes
  14. Redo Buffers 4919296 bytes
  15. Database mounted.
  16. Database opened.
  17. SYS@HOEGH>


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

相關文章