ORA 1157錯誤解決

2022-07-26 22:54:17 字數 2057 閱讀 3775

一.錯誤描述 

ora-1157, "cannot identify/lock data file %s - see dbwr trace file" 

引起的原因: 

因為資料檔案已經在被使用了從而導致資料庫的後台程序不能找到相應的資料檔案或者不能鎖定相應的資料檔案,這樣資料庫將禁止訪問這些資料檔案而其他的資料檔案則沒有影響。伴隨這個錯誤作業系統將會提示是哪個資料檔案不能被識別。 

ora-01157錯誤一般和ora-01110錯誤一起出現,往往還有作業系統級別上的錯誤,例如ora-07360,同時乙個dbwr的trace檔案會在background_dump_dest的目錄下生成。例如,在solaris的平台上,會有如下的錯誤資訊顯示: 

ora-01157: cannot identify/lock data file 5 - see dbwr trace file 

ora-01110: data file 5: '/export/home/oracle/oradata/817/users01.dbf' 

然後檢視dbwr的trace檔案內容,會有如下的內容: 

ora-01157: cannot identify/lock data file 5 - see dbwr trace file 

ora-01110: data file 5: '/export/home /oracle/oradata/817/users01.dbf' 

ora-27037: unable to obtain file status 

svr4 error: 2: no such file or directory 

additional information: 3 

二. 通常引起ora-1157錯誤的原因和解決方法 

如果你是使用oracle9i,就用sqlplus代替svrmgrl執行以下的命令。 

1. 資料檔案存在,但是oracle認不到它 

這種情況可能是在作業系統級上資料檔案被重新命名了或者移動到了乙個新的分割槽或者位置,這種情況比較簡單,只是需要將資料檔案恢復成原始的資料檔案名字或者重新命名資料檔案到乙個新的位置/目錄就可以解決問題了。 

重新命名資料檔案到乙個新的位置/目錄的方法: 

a. 資料庫是開啟狀態的 

1)檢視那個資料檔案所在的表空間還包含有哪些資料檔案,執行以下查詢: 

select file_name, status from dba_data_files 

where tablespace_name = ''; 

2)確定所有資料檔案的狀態都是可用的。 

3)把錶空間變成唯讀表空間: 

alter tablespace read only; 

4)確定在資料字典中表空間是顯示為唯讀的: 

select tablespace_name, status from dba_tablespaces 

where tablespace_name = ''; 

tablespace_name status 

------------------------------ --------- 

read only 

5)用作業系統命令拷貝資料檔案到乙個新的位置,拷貝完成後把整個表空間 

offline,這個時候使用者是不能訪問這個表空間的: 

alter tablespace offline; 

6)重新命名這個資料檔案到乙個新的位置了,這個操作會自動的更新控制檔案中的內容: 

alter database rename file 

'/full_path_of_old_location/and_datafile_name.dbf' 

to '/full_path_of_new_location/and_datafile_name.dbf'; 

7)online這個表空間: 

alter tablespace your_tablespace_name online; 

8)把這個表空間置成可讀寫的狀態: 

alter tablespace your_tablespace_name read write; 

9)在作業系統級上刪除原來舊的資料檔案。 

ORA 12571 ORA 03113錯誤解決

問題現象 windows2000 環境下system 檔案壞掉了,不能啟動,修復以後機器是啟動了,但發現原來的 oracle 服務都不見了,也沒有什麼重要的資料,就重灌了一遍,裝完以後一切正常,連線 oracle 正常,重啟動機器以後發現連線 oracle 出現錯誤 ora 12571 tns 包寫...

錯誤解決 ORA 01036

最近寫程式時,往oracle中插入資料,出現錯誤ora 01036 非法的變數名 編號,如下 dbconnection conn getcon conn.open dbcommand cmd conn.createcommand string sqlrt insert into t user id,...

ORA 08104錯誤解決

img 重新建立索引,會告訴你該索引已經存在,drop index 會告訴你該索引被鎖,或者是 ora 08104 this index object xx is being online built or rebuilt 錯誤。該過程失敗之前建立的一些臨時物件由 smon 負責清除,糟糕的是,sm...