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
相關文章
相關標籤/搜索