程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle教程 >> 【續】ORA-01157:cannotidentify/lockdatafile6-seeDBWRtracefileOR

【續】ORA-01157:cannotidentify/lockdatafile6-seeDBWRtracefileOR

編輯:Oracle教程

在數據庫中創建表空間 tyger2 在linux系統文件中刪除了數據文件 tyger2_01.dbf 啟動數據庫報錯,

重新創建名字為tyger2_01.dbf 文件,數據庫正常啟動,但是數據文件中的數據一定不在了。

啟動 Oracle 數據庫實例:OPEN
數據庫操作正常意味著實例已啟動、數據庫已裝載且已打開。通過執行正常數據庫操作,任何有效用戶都可連接到數據庫,而且可執行典型數據訪問操作。
打開數據庫過程包括執行以下任務:
打開聯機數據文件
打開聯機重做日志文件
如果嘗試打開數據庫時任一數據文件或聯機重做日志文件不存在,則 Oracle 服務器返回錯誤。
在最後這個階段,Oracle 服務器會驗證是否可以打開所有的數據文件和聯機重做日志文件,還會檢查數據庫的一致性。如有必要,系統監視器 (SMON) 後台進程將啟動實例恢復。
可以在受限模式下啟動數據庫實例,使得只讓有管理權限的用戶使用該實例。要在受限模式下啟動實例,請在“Advanced Startup Options(高級啟動選項)”頁上選擇“Restrict access to database(限制對數據庫進行訪問)”選項。

接著實驗:

http://blog.csdn.net/wanghui5767260/article/details/20293807

【精】ORA-01157: cannot identify/lock data file 6 - see DBWR trace file ORA-01110: 解決方法

[oracle@tyger ~]$ sqlplus / as sysdba


SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 2 17:21:38 2014


Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options


SYS@ORCL>create tablespace tyger2 datafile '/u01/app/oracle/oradata/ORCL/tyger2_01.dbf' size 5m;


Tablespace created.


SYS@ORCL>create user tygeru2 identified by tygeru2 account unlock default tablespace tyger2;
create user tygeru2 identified by tygeru2 account unlock default tablespace tyger2
*
ERROR at line 1:
ORA-01920: user name 'TYGERU2' conflicts with another user or role name

SYS@ORCL>alter user tygeru2 default tablespace tyger2;


User altered.


SYS@ORCL>conn tygeru2/tygeru2
Connected.
TYGERU2@ORCL>select username,default_tablespace from user_users;


USERNAME DEFAULT_TABLESPACE
------------------------------ ------------------------------
TYGERU2 TYGER2


TYGERU2@ORCL>create table u2_t1 as select * from scott.emp;


Table created.


TYGERU2@ORCL>
TYGERU2@ORCL>commit;


Commit complete.


TYGERU2@ORCL>select count(*) from u2_t1;


COUNT(*)
----------
14


TYGERU2@ORCL>!
[oracle@tyger ~]$ cd $ORACLE_BASE/oradata/ORCL
[oracle@tyger ORCL]$ ll
total 1068456
-rw-r----- 1 oracle oinstall 7061504 Mar 2 17:25 control01.ctl
-rw-r----- 1 oracle oinstall 7061504 Mar 2 17:25 control02.ctl
-rw-r----- 1 oracle oinstall 7061504 Mar 2 17:25 control03.ctl
-rw-r----- 1 oracle oinstall 104865792 Mar 2 17:19 example01.dbf
-rw-r----- 1 oracle oinstall 52429312 Mar 2 17:19 redo01.log
-rw-r----- 1 oracle oinstall 52429312 Mar 2 17:19 redo02.log
-rw-r----- 1 oracle oinstall 52429312 Mar 2 17:25 redo03.log
-rw-r----- 1 oracle oinstall 251666432 Mar 2 17:24 sysaux01.dbf
-rw-r----- 1 oracle oinstall 503324672 Mar 2 17:24 system01.dbf
-rw-r----- 1 oracle oinstall 20979712 Mar 1 08:42 temp01.dbf
-rw-r----- 1 oracle oinstall 5251072 Mar 2 17:25 tyger2_01.dbf
-rw-r----- 1 oracle oinstall 26222592 Mar 2 17:24 undotbs01.dbf
-rw-r----- 1 oracle oinstall 5251072 Mar 2 17:19 users01.dbf
[oracle@tyger ORCL]$ mv tyger2_01.dbf tyger2_01.dbf.bak
[oracle@tyger ORCL]$ ll
total 1068456
-rw-r----- 1 oracle oinstall 7061504 Mar 2 17:25 control01.ctl
-rw-r----- 1 oracle oinstall 7061504 Mar 2 17:25 control02.ctl
-rw-r----- 1 oracle oinstall 7061504 Mar 2 17:25 control03.ctl
-rw-r----- 1 oracle oinstall 104865792 Mar 2 17:19 example01.dbf
-rw-r----- 1 oracle oinstall 52429312 Mar 2 17:19 redo01.log
-rw-r----- 1 oracle oinstall 52429312 Mar 2 17:19 redo02.log
-rw-r----- 1 oracle oinstall 52429312 Mar 2 17:25 redo03.log
-rw-r----- 1 oracle oinstall 251666432 Mar 2 17:24 sysaux01.dbf
-rw-r----- 1 oracle oinstall 503324672 Mar 2 17:24 system01.dbf
-rw-r----- 1 oracle oinstall 20979712 Mar 1 08:42 temp01.dbf
-rw-r----- 1 oracle oinstall 5251072 Mar 2 17:25 tyger2_01.dbf.bak
-rw-r----- 1 oracle oinstall 26222592 Mar 2 17:24 undotbs01.dbf
-rw-r----- 1 oracle oinstall 5251072 Mar 2 17:19 users01.dbf
[oracle@tyger ORCL]$ exit
exit


TYGERU2@ORCL>conn / as sysdba
Connected.
SYS@ORCL>shutdown abort
ORACLE instance shut down.
SYS@ORCL>startup
ORACLE instance started.


Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 138413648 bytes
Database Buffers 142606336 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 6: '/u01/app/oracle/oradata/ORCL/tyger2_01.dbf'


SYS@ORCL>alter database datafile 6 offline drop;


Database altered.


SYS@ORCL>alter database open;


Database altered.


SYS@ORCL>conn tygeru2/tygeru2
Connected.
TYGERU2@ORCL>select count(*) from u2_t1;
select count(*) from u2_t1
*
ERROR at line 1:
ORA-00376: file 6 cannot be read at this time
ORA-01110: data file 6: '/u01/app/oracle/oradata/ORCL/tyger2_01.dbf'



結論:

數據庫可以啟動了,但是數據問價已經在數據庫中drop了 所以數據都不存在了

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved