ORA-01157: cannot identify/lock data file n 故障一例
-----轉載於:http://blog.csdn.net/leshami/article/details/8179253
最近在使用swingbench的時候碰到了ORA-01157故障,下面是其具體描述與解決。
- 1、故障現象
- --查詢檢視dba_data_files時出現ORA-01157故障
- SQL> select file_name,tablespace_name from dba_data_files where tablespace_name='SOE';
- select file_name,tablespace_name from dba_data_files where tablespace_name='SOE'
- *
- ERROR at line 1:
- ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
- ORA-01110: data file 6: '/u01/oracle/db/dbs/soe.dbf'
- --嘗試drop tablespace 收到同樣的錯誤
- SQL> drop tablespace soe including contents and datafiles;
- drop tablespace soe including contents and datafiles
- *
- ERROR at line 1:
- ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
- ORA-01110: data file 6: '/u01/oracle/db/dbs/soe.dbf'
- 2、分析
- --從錯誤號後的文字可判斷DBWR不能識別或鎖定檔案號6,後面的ORA-01110給出了具體的檔案位置
- --下面是錯誤號對應的具體描述
- SQL> ho oerr ora 01157
- 01157, 00000, "cannot identify/lock data file %s - see DBWR trace file"
- // *Cause: The background process was either unable to find one of the data
- // files or failed to lock it because the file was already in use.
- // The database will prohibit access to this file but other files will
- // be unaffected. However the first instance to open the database will
- // need to access all online data files. Accompanying error from the
- // operating system describes why the file could not be identified.
- // *Action: Have operating system make file available to database. Then either
- // open the database or do ALTER SYSTEM CHECK DATAFILES.
- --上面的描述指出了後臺程式不能尋找到資料檔案或者是因為檔案在被其他程式使用而DBWR無法對其鎖定。
- --對於象這類檔案資料庫將禁止對其進行訪問,而其他資料檔案則不受影響。
- --給出的決辦法是確認錯誤號後的資料檔案是否存在或可用,以及在open狀態下執行ALTER SYSTEM CHECK DATAFILES命令
- 3、解決
- --嘗試執行alter system check datafiles
- SQL> alter system check datafiles;
- System altered.
- --執行後故障依舊如下
- SQL> select file_name,tablespace_name from dba_data_files where tablespace_name='SOE';
- select file_name,tablespace_name from dba_data_files where tablespace_name='SOE'
- *
- ERROR at line 1:
- ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
- ORA-01110: data file 6: '/u01/oracle/db/dbs/soe.dbf'
- --檢視資料字典記錄的資訊表明當前的表空間為online狀態
- SQL> select tablespace_name,status,contents from dba_tablespaces where tablespace_name='SOE';
- TABLESPACE_NAME STATUS CONTENTS
- ------------------------------ --------- ---------
- SOE ONLINE PERMANENT
- --檢視alert日誌檔案,也給出了該錯誤提示,提示給出了tarce檔案
- oracle@v2048db01p:/u01/oracle/admin/SYISDB/bdump> tail -8 alert_SYISDB1.log
- Additional information: 3
- Tue Nov 13 09:43:17 2012
- Errors in file /u01/oracle/admin/SYISDB/bdump/syisdb1_dbw0_5925.trc:
- ORA-01186: file 6 failed verification tests
- ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
- ORA-01110: data file 6: '/u01/oracle/db/dbs/soe.dbf'
- Tue Nov 13 09:43:17 2012
- File 6 not verified due to error ORA-01157
- --檢視錶空間soe對應的資料檔案是否存在
- oracle@v2048db01p:~> export ORACLE_SID=+ASM1
- oracle@v2048db01p:~> asmcmd
- ASMCMD> cd +DG2/SYISDB/DATAFILE
- ASMCMD> ls
- CCDATA.289.799174049
- SYSAUX.260.796819341
- SYSTEM.259.796819335
- UNDOTBS1.261.796819339
- UNDOTBS2.257.796819343
- USERS.256.796819343
- X.290.799234531
- ccdata.dbf
- ASMCMD> ls *soe* --#沒有任何含soe的資料檔案
- asmcmd: entry '*soe*' does not exist in directory '+DG2/SYISDB/DATAFILE/'
- ASMCMD> ls *SOE* --#沒有任何含soe的資料檔案,由此可知表空間soe對應的資料檔案已經丟失
- asmcmd: entry '*SOE*' does not exist in directory '+DG2/SYISDB/DATAFILE/'
- --因此直接刪除該表空間及資料檔案,注,生產環境不建議此操作
- SQL> alter database datafile 6 offline drop;
- Database altered.
- --再次檢視資料字典資訊,依然處於Online狀態
- --Author : Robinson
- --Blog : http://blog.csdn.net/robinson_0612
- SQL> select tablespace_name,status,contents from dba_tablespaces where tablespace_name='SOE';
- TABLESPACE_NAME STATUS CONTENTS
- ------------------------------ --------- ---------
- SOE ONLINE PERMANENT
- --下面的查詢貌似也有問題,對應的資料檔案在上一命令中已經清除了,而此時依舊顯示AVAILABLE
- SQL> col file_name format a55
- SQL> set linesize 160
- SQL> select file_name,tablespace_name,status from dba_data_files where tablespace_name='SOE';
- FILE_NAME TABLESPACE_NAME STATUS
- ---------------------------------------- ------------------------------ ---------
- /u01/oracle/db/dbs/soe.dbf SOE AVAILABLE
- --嘗試在該表空間建立物件,收到了ORA-01658錯誤
- SQL> create table t tablespace soe as select * from dba_objects;
- create table t tablespace soe as select * from dba_objects
- *
- ERROR at line 1:
- ORA-01658: unable to create INITIAL extent for segment in tablespace SOE
- --檢視對應的錯誤資訊
- --錯誤資訊表明沒有足夠的連續空間分配初始extent.
- SQL> ho oerr ora 01658
- 01658, 00000, "unable to create INITIAL extent for segment in tablespace %s"
- // *Cause: Failed to find sufficient contiguous space to allocate INITIAL
- // extent for segment being created.
- // *Action: Use ALTER TABLESPACE ADD DATAFILE to add additional space to the
- // tablespace or retry with a smaller value for INITIAL
- --再次檢視狀態,發現此時對應的資料檔案為RECOVER
- SQL> col file_name format a40
- SQL> select file_name,tablespace_name,status,ONLINE_STATUS from dba_data_files where tablespace_name='SOE';
- FILE_NAME TABLESPACE_NAME STATUS ONLINE_
- ---------------------------------------- ------------------------------ --------- -------
- /u01/oracle/db/dbs/soe.dbf SOE AVAILABLE RECOVER
- --檢視v$recover_file檢視,給出檔案未找到OFFLINE FILE NOT FOUND
- SQL> select * from v$recover_file;
- FILE# ONLINE ONLINE_ ERROR CHANGE# TIME
- ---------- ------- ------- ----------------------------------------------------------------- ---------- ------------------
- 6 OFFLINE OFFLINE FILE NOT FOUND 0
- --檢視對應的資料檔案也不存在
- SQL> ho ls -hltr /u01/oracle/db/dbs/soe.dbf
- ls: /u01/oracle/db/dbs/soe.dbf: No such file or directory
- --刪除整個表空間及資料檔案
- SQL> drop tablespace soe including contents and datafiles;
- Tablespace dropped.
- --下面的查詢表示表空間soe已經被徹底清除
- SQL> select * from v$recover_file;
- no rows selected
- SQL> select file_name,tablespace_name,status,ONLINE_STATUS from dba_data_files where tablespace_name='SOE';
- no rows selected
總結:
ORA-01157通常由後臺程式DBWR鎖定而產生。
如果在恢復期間,如資料庫已經mount,而一個或多個資料檔案不能開啟導致資料庫不能open時會出現該提示。
資料檔案丟失,資料檔案的許可問題,如資料檔案oracle使用者沒有寫許可權等都會產生ORA-01157。
如果open狀態的情形下,ORA-01157未列出的資料檔案不會受到影響。
補充說明:
細心的朋友應該可能已經發現當時在檢查對應的資料檔案的時候,只檢查了ASM磁碟是否存在對應的資料檔案。
由於出錯資料庫為RAC,因此忽略了檢查提示中的檔案系統對應的資料檔案。說來還是不夠仔細,狂汗......
就其原因應該是這樣,在使用swingbench時,建立soe表空間時直接一路next,導致將資料檔案建立到了檔案系統,而檔案系統是非共享的。(RAC環境)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29119536/viewspace-1093520/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle ORA-01157: cannot identify/lock data file 64OracleIDE
- ORA-01157: cannot identify/lock data file %s - see DBWR trace file的處理IDE
- [Oracle]--Library cache lock 故障解決一例Oracle
- Weblogic BEA-141281 unable to get file lock, will retry 故障處理Web
- unable to get file lock, will retry ...
- MySQL SLAVE故障一例MySql
- 網路故障一例
- iostat -n來統計NFS讀寫資訊時碰到了Cannot open /proc/self/mountstats: No such file or directoryiOSNFS
- ThunderSoft File Lock for Mac檔案鎖Mac
- OGG 故障處理一例
- goldengate故障處理一例Go
- sqlplus cannot execute binary fileSQL
- libmysqlclient.so.16: cannot open shared object file: No such file or directoryIBMMySqlclientObject
- libcap.so.1:cannot open shared object file: No such file or directoryObject
- libXext.so.6: cannot open shared object file: No such file or directoryObject
- libz.so.1: cannot open shared object file: No such file or directoryObject
- 452 Error writing file: A file cannot be larger than the value set by ulimit.ErrorMIT
- vmwareworkstation虛擬網路故障一例
- ORA-00054 故障處理一例
- Rownum分頁故障解決一例
- goldengate故障處理一例(續)Go
- database link故障處理一例Database
- "OPatch failed with error code 73"故障一例AIError
- VMware vmdk錯誤: Failed to lock the file.AI
- HP -Data Protector Restore file systemREST
- ImportError: libffi.so.7: cannot open shared object file: No such file or directoryImportErrorObject
- ulimit: core file size: cannot modify limit: Operation not permittedMIT
- namenode gc導致的故障一例薦GC
- ORA-03232故障解決一例
- 處理mysql複製故障一例薦MySql
- Unable to create index.lock File exists錯誤Index
- Android:Unexpected lock protocol found in lock file. Expected 3, found 0.AndroidProtocol
- kafka啟動報錯:kafka.common.KafkaException: Failed to acquire lock on file .lockKafkaExceptionAIUI
- sqlldr Field in data file exceeds maximum lengthSQL
- data file int write和db file sequential read個人想法
- 9 Oracle Data Guard 故障診斷Oracle
- Cannot find SS.INI file for user *** 解決方法
- O/S-Error: (OS 33) The process cannot access the fileError