oracle丟失temp表空間的處理方法
之前有做臨時(shí)表空間的切換,切換后沒(méi)drop tablespace就刪除了temp01.dbf結(jié)果排序跟查dba_temp_files報(bào)錯(cuò)
SQL> select tablespace_name,file_id,file_name,bytes/1024/1024 Mbytes from dba_temp_files; select tablespace_name,file_id,file_name,bytes/1024/1024 Mbytes from dba_temp_files * ERROR at line 1: ORA-01116: error in opening database file 201 ORA-01110: data file 201: "/home/oracle/oradata/osa/temp01.dbf" ORA-27041: unable to open file Linux-x86_64 Error: 2: No such file or directory Additional information: 3
兩種方法可以恢復(fù)
1、重啟數(shù)據(jù)庫(kù)
重啟后系統(tǒng)會(huì)自動(dòng)重建,數(shù)據(jù)庫(kù)會(huì)提示re-creating在bdump的alter_sid.log中
Re-creating tempfile /home/oracle/oradata/osa/temp01.db
2、重建
alter tablespace temp add tempfile '/oracle/oradata/osa/temp03.dbf' size 50m;
alter tablespace temp drop tempfile '/oracle/oradata/osa/temp01.dbf' ;
Oracle 11g的Temp表空間怎么恢復(fù)?
答案是系統(tǒng)會(huì)自動(dòng)重建;
實(shí)驗(yàn)如下:
我們先查看Temp表空間對(duì)應(yīng)的數(shù)據(jù)文件
SQL> select FILE_NAME,TABLESPACE_NAME,STATUS from dba_temp_files; FILE_NAME TABLESPACE_NAME STATUS ---------------------------------------- ------------------------------------------------------------------------------------------ --------------------- /u01/oracle/oradata/orcl/temp01.dbf TEMP ONLINE
然后登陸到sys用戶下,shutdown immediate
在文件系統(tǒng)層面去刪除該數(shù)據(jù)文件
cd /u01/oracle/oradata/orcl/ ls rm -f temp01.dbf
啟動(dòng)過(guò)程中,可觀察到Alert日志中出現(xiàn)如下語(yǔ)句
Re-creating tempfile /u01/oracle/oradata/orcl/temp01.dbf
然后Oracle正常啟動(dòng),查看文件系統(tǒng),又多了temp01.dbf
實(shí)驗(yàn)結(jié)束。
還有一種情況,考慮到生產(chǎn)環(huán)境,數(shù)據(jù)庫(kù)需要7*24小時(shí)的運(yùn)轉(zhuǎn),假如說(shuō)運(yùn)行過(guò)程中temp數(shù)據(jù)文件出問(wèn)題,而該問(wèn)題又沒(méi)有導(dǎo)致數(shù)據(jù)庫(kù)異常關(guān)閉的情況下,該如何修復(fù)? 值得注意的是,temp表有排序的功能。
由于實(shí)驗(yàn)過(guò)程不好模擬,我們需要執(zhí)行的操作就是丟一個(gè)temp02.dbf的數(shù)據(jù)文件給臨時(shí)表空間,然后去掉temp01.dbf的數(shù)據(jù)文件就可以了。
相關(guān)文章:
1. 如何正確的進(jìn)行Oracle數(shù)據(jù)庫(kù)性能完全保護(hù)2. ubuntu下使用SQLite3的基本命令3. 講解Oracle優(yōu)化器的優(yōu)化方式和優(yōu)化模式4. SQL SERVER – 檢測(cè)LOCK、終止會(huì)話 ID/UOW 的用戶進(jìn)程5. DB2 V9.5工作負(fù)載管理之工作負(fù)載管理簡(jiǎn)介6. 國(guó)內(nèi)學(xué)院派專家對(duì)DB2 9新產(chǎn)品贊不絕口7. SQLite教程(四):內(nèi)置函數(shù)8. MySQL存儲(chǔ)過(guò)程in、out和inout參數(shù)示例和總結(jié)9. 教你使用智能優(yōu)化器提高Oracle性能極限10. SQL Server數(shù)據(jù)庫(kù)的三種創(chuàng)建方法匯總
