【Oracle】ORA-01157: cannot identify/lock data file 201

今天数据库在查询数据的时候显示了这个错误:

ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '/u01/app/oracle/oradata/ORA11GR2/temp01.dbf'
---查看临时表空间
SYS@GOOD> select FILE_NAME, TABLESPACE_NAME from dba_temp_files;
select FILE_NAME, TABLESPACE_NAME from dba_temp_files
                                       *
ERROR at line 1:
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '/u01/app/oracle/oradata/ORA11GR2/temp01.dbf'

很明显这是我的临时表空间数据文件丢失了,导致不能查看数据文件

解决办法:

---删除文件
SYS@GOOD> alter database tempfile '/u01/app/oracle/oradata/ORA11GR2/temp01.dbf'drop;

Database altered.
---重建文件
SYS@GOOD> alter tablespace temp add tempfile'/u01/app/oracle/oradata/GOOD/temp01.dbf'size 100M;

Tablespace altered.

---验证文件
SYS@GOOD> select file_name,tablespace_name from dba_temp_files;

FILE_NAME                                       TABLESPACE_NAME
----------------------------------------------  -------
/u01/app/oracle/oradata/GOOD/temp01.dbf         TEMP
原文地址:https://www.cnblogs.com/NextAction/p/7366678.html