现在的位置: 首页 > 综合 > 正文

ora-01116

2013年10月10日 ⁄ 综合 ⁄ 共 2178字 ⁄ 字号 评论关闭

数据库报错:
ora-01116: eror in opening database file 201
ora-01110:data file 201 : '/home/app/oracle/oradata/testmod/tEMP02.DBF'
ora-27041:unable to open file
Linux-x86_64 Error: 2: No such file or directory

ora-01122: database file 201 failed verification check

处理思路:
1) 查看操作系统上的数据文件是否存在
tEMP02.DBF文件不存在
2) 查看aler.log
TEMP表空间创建时,添加了数据文件tEMP02.DBF,但是日志中没有记录数据文件的删除操作,怀疑数据文件是在操作系统级别使用rm命令删除的。
3) 查看临时表空间状态  -- tablespace_name
临时表空间状态为ONLINE,正常 
-- 这个不准确,表空间状态正常,但是可能数据文件已经丢失
4) 查看临时表空间的数据文件状态 -- dba_temp_files
报错 ora-01116/01110/27041 --
5) 脱机临时表空间的数据文件或者脱机临时表空间 
-- 脱机tempdata或temporary tablespace不会造成源数据丢失
alter databae tempfile '/home/app/oracle/oradata/testmod/tEMP02.DBF' offline;
6) 添加数据文件
alter tablespace add tempfile '/patch/to/datafile.dbf' size 10M;
因为这次丢失的临时表空间的数据文件,不会造成数据丢失,所以可以直接把丢失的数据文件脱机(这个数据文件,在操作系统级别已经不存在了),然后添加一个文件使oracle恢复到正常状态。

原因:
操作不规范,数据文件被从操作系统级别删除,导致数据库状态异常,出现ORA-01116错误。

总结:
         如果要删除数据文件,请按照oracle的使用规范来操作(官方手册)。
 数据文件offline后, 然后从操作系统级别删除,其实数据文件的信息还保存在数据字典中!长时间将数据文件offline,可能这个数据文件就再也不会online了。
参考资料:
 删除数据文件:
The following example drops the datafile identified by the alias example_df3.f in the ASM disk group DGROUP1. The datafile belongs to the example tablespace.
ALTER TABLESPACE example DROP DATAFILE '+DGROUP1/example_df3.f';
The next example drops the tempfile lmtemp02.dbf, which belongs to the lmtemp tablespace.
ALTER TABLESPACE lmtemp DROP TEMPFILE '/u02/oracle/data/lmtemp02.dbf';
This is equivalent to the following statement:
ALTER DATABASE TEMPFILE '/u02/oracle/data/lmtemp02.dbf' DROP
     INCLUDING DATAFILES;

Restrictions for Dropping Datafiles
The following are restrictions for dropping datafiles and tempfiles:
• The database must be open.
• If a datafile is not empty, it cannot be dropped.
If you must remove a datafile that is not empty and that cannot be made empty by dropping schema objects, you must drop the tablespace that contains the datafile.
• You cannot drop the first or only datafile in a tablespace.
Therefore, DROP DATAFILE cannot be used with a bigfile tablespace.
• You cannot drop datafiles in a read-only tablespace that was migrated from dictionary managed to locally managed. Dropping a data file from all other read-only tablespaces is supported.
• You cannot drop datafiles in the SYSTEM tablespace.
• If a datafile in a locally managed tablespace is offline, it cannot be dropped.
链接:
http://docs.oracle.com/cd/E11882_01/server.112/e25494/dfiles006.htm#ADMIN11435

 

抱歉!评论已关闭.