1. 程式人生 > >ORA-01157: cannot identify/lock data file n 故障一例

ORA-01157: cannot identify/lock data file n 故障一例

    最近在使用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檔案
[email protected]
:/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對應的資料檔案是否存在
[email protected]
:~> export ORACLE_SID=+ASM1 [email protected]:~> 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環境)

更多參考:

有關基於使用者管理的備份和備份恢復的概念請參

有關RMAN的備份恢復與管理請參

有關ORACLE體系結構請參

相關推薦

ORA-01157: cannot identify/lock data file n 故障

    最近在使用swingbench的時候碰到了ORA-01157故障,下面是其具體描述與解決。1、故障現象 --查詢檢視dba_data_files時出現ORA-01157故障 SQL> select file_name,tablespace_name from d

rac ORA-001157 數據文件誤創 本地盤 共享存儲 ASM cannot identify/lock data file

oracle rac 誤將數據文件創建在本地盤而不是共享存儲錯誤原因:不是共享存儲中的數據文件,其他實例不能訪問解決思路和辦法:把本地的數據文件移到共享存儲中。步驟;1. offline 表空間或數據文件2. 復制數據文件3. 重命名數據文件4. 恢復數據文件(表空間不用)5. online 表空間或

全表掃描卻產生大量db file sequential read

開發人員在進行新系統上線前的資料校驗測試時,發現一條手工執行的SQL執行了超過1小時還沒有返回結果。SQL很簡單: SELECT *     FROM MOBILE_call_1204_OLD    WHERE BILLING_NBR = '189xxxxxxxx'

ORA-00942:表或檢視不存在 低階錯誤

ORA-00942:表或檢視不存在低階錯誤一例 執行查詢語句,報ORA-00942錯誤 檢查後發現沒有指定表的所屬使用者,新增使用者,再次查詢,查詢正常,截圖如下: *********

PIL及matplotlib:OSError: cannot identify image file錯誤及解決方式

PIL及matplotlib:OSError: cannot identify image file錯誤及解決方式 前言 錯誤訊息 問題排查 解決方法 後記 PIL跟Pillow的關係 matplotlib讀圖的方式

git提交代碼出現錯誤fatal: Unable to create '項目路徑/.git/index.lock': File exists.

log stack sts exists 下一個 flow code .cn create git提交代碼出現錯誤fatal: Unable to create ‘項目路徑/.git/index.lock‘: File exists. 具體出錯代碼如下: 具體原因不詳

ImportError: libmysqlclient.so.20: cannot open shared object file: No such file or directory 解決辦法

object init ror 文件 module libmysql 找到 str 軟連接 >>> import MySQLdbTraceback (most recent call last): File "<stdin>", line

java 罕見的依賴報錯 jstat: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

玩意兒 rpm 文件 .com pen jdk1 obj not found linu java 都用了N長時間了,突然,意外地發現有一個依賴的so文件從來沒找見過 # ldd /usr/bin/java linux-vdso.so.1 => (0x00007ff

iptables報錯:Couldn't load target `accept':/lib64/iptables/libipt_accept.so: cannot open shared object file: No such file or directory

大寫 obj direct 規則 lib not blog acc get 語句:iptables -A INPUT -s 134.192.204.235 -p TCP --dport 11211 -j accept 報錯:Couldn‘t load target `acc

How to Change Default Location for Outlook Data File (PST & OST)

note right folder dialog https error data locate http Is there a way to change the default location of new .pst file when create a new e-

error while loading shared libraries: libssl.so.6: cannot open shared object file

ldd yum check_tcp libssl.so.6 openssl098e-0.9.8e-20 [root@ ~]# /usr/local/nagios/libexec/check_tcp -H 127.0.0.1 80/usr/local/nagios/libexec/check

ogg啟動報錯libnnz11.so: cannot open shared object file

version pat director ggsci 11.2.1 aries targe 64bit ews 當ogg軟件解壓,並給予正確的權限後,在啟動ogg時會遇到如下報錯: [[email protected]/* */ ogg]# ./ggsci./g

tar(child):bzip2:Cannot exec: No such file and directory

bzip2 下午從阿裏雲拷貝一個比較大的壓縮包到另外一臺阿裏雲主機,使用scp發現拷貝速度有點慢,想起以前用過pv+lz+tar的方法傳輸Linux下的大數據,二話不說,開始幹。因為是翻墻下載的包,一開始以為是自己下載的安裝包有問題,但仔細看了下提示“bzip2:Cannot exec...”,想了下,

PyCharm ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory 解決辦法

圖片 object shared 8.0 body har error err cto PyCharm ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or d

11g rac ORA-01157問題處理

ORA-01157 數據文件路徑錯誤 年假還沒休完,就接到一個工作。某客戶數據庫異常,無法讀取數據,大概了解了下原因,早上就坐車來到了生命之環,確實是比較有氣勢,天氣也不錯,心情也很好。 一、環境11g rac rhel 6.8 二、報錯信息SQL> select file_name from

ORA-01102: cannot mount database in EXCLUSIVE 處理方法

ORA-01102:今天啟動rac數據庫一個節點時報錯了! SQL> startup mount ORACLE instance started. Total System Global Area 608174080 bytes Fixed Size 1

ubuntu下tensorflow 報錯 libcusolver.so.8.0: cannot open shared object file: No such file or directory

export direct config sudo 8.0 ring 終端 運行 ber 解決方法1. 在終端執行: export LD_LIBRARY_PATH=”$LD_LIBRARY_PATH:/usr/local/cuda/lib64” export CUDA_H

error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory解決

make scp AR object normal memcache window 2.0 HA 我是從其他服務器scp來的memcached(~~~整個文件夾的那種,windows用多了的後遺癥) 在準備運行 ./memcached -d -u root -l loca

ORA-01102: cannot mount database in EXCLUSIVE mode

ora- bsp tar ota sys variable 共享內存 hit -m 有臺測試環境的數據庫,因磁盤爆了,新加了一塊硬盤,在啟動的時候數據庫崩了SQL> startup mount ORACLE instance started. Total

報錯解決——pytesseract.pytesseract.TesseractError: (1,’Error opening data file /usr/local/share/tessdata/eng.traineddata’)

target tac ssd 方法 question ack oca .gz sda 解決方法:(原文地址http://stackoverflow.com/questions/14800730/tesseract-running-error) $ wget http