oracle--表空间故障

一,错误问题描述

ERROR:
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '/u01/oracle/TEST/oratmp01/temp/temp01.dbf'
ORA-06512: at "SYS.DBMS_METADATA", line 4018
ORA-06512: at "SYS.DBMS_METADATA", line 5843
ORA-06512: at line 1

二,解决方式

想数据文件被清掉了,先给offline了重新配置一下。
offline不可以,offline drop也不行。
SQL> alter database datafile '/u01/oracle/TEST/oratmp01/temp/temp01.dbf' offline;
alter database datafile '/u01/oracle/TEST/oratmp01/temp/temp01.dbf' offline
*
ERROR at line 1:
ORA-01516: nonexistent log file, data file, or temporary file
"/u01/oracle/TEST/oratmp01/temp/temp01.dbf"

SQL> alter database datafile '/u01/oracle/TEST/oratmp01/temp/temp01.dbf' offline drop;
alter database datafile '/u01/oracle/TEST/oratmp01/temp/temp01.dbf' offline drop
*
ERROR at line 1:
ORA-01516: nonexistent log file, data file, or temporary file
"/u01/oracle/TEST/oratmp01/temp/temp01.dbf"

不能offline,offline drop,有的人说得放在mount状态下执行,我试了也不行。
我直接删除表空间重新建得了,oracle已经开始给我哭穷了,说不能删除默认的临时表空间。
SQL> drop tablespace temp including contents and datafiles;
drop tablespace temp including contents and datafiles
*
ERROR at line 1:
ORA-12906: cannot drop default temporary tablespace

那我删除这个临时文件,oracle又说这个临时表空间里只有一个数据文件。
SQL> alter tablespace temp drop tempfile '/u01/oracle/TEST/oratmp01/temp/temp01.dbf';
alter tablespace temp drop tempfile '/u01/oracle/TEST/oratmp01/temp/temp01.dbf'
*
ERROR at line 1:
ORA-03261: the tablespace TEMP has only one file

我还是自己查看下文件夹到底在不在。一查文件夹都被清掉了。
SQL> !ls -l /dbusgsPT1/oracle/PETUSG1/oratmp01/temp
ls: /dbusgsPT1/oracle/PETUSG1/oratmp01/temp: No such file or directory

先把文件夹给补上
SQL> !mkdir -p /u01/oracle/TEST/oratmp01/temp
建立一个别名的临时文件,马上见temp01的临时数据文件还不行。
SQL> alter tablespace temp add tempfile '/u01/oracle/TEST/oratmp01/temp/temp02.dbf'  size 20G;
Tablespace altered.
然后再去删除其实不存在的临时数据文件。从数据字典里进行更新。
SQL> alter tablespace temp drop tempfile '/u01/oracle/TEST/oratmp01/temp/temp01.dbf';
Tablespace altered.
后续就如果需要可以把临时数据文件的名字从temp02.dbf改成temp01.dbf
侵删:https://cloud.tencent.com/developer/article/105954

 

posted on 2019-08-28 15:09  kingle-l  阅读(617)  评论(0编辑  收藏  举报

levels of contents