有一個數據表的insert、delete操作頻繁,空間無釋放。唯有進行一次導出、DROP、導入操作。
當前數據量:接近6億
估計其中有一部分數據太舊,所以使用帶條件的導出。
$>export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
$>exp user/pass file=XXX.dmp buffer=409600000 tables=mybigtable query=/" where somedate/>=XXX/"
導出數據約3.7億,占用空間約57G。
導出后drop掉原表
drop table mybigtable cascade constraints
導入
imp user/pass file=XXX
導入本來是很簡單的操作,但需要很大的臨時表空間(最后占用了12G)
需要有大的空間存放temp01.dbf文件
temp01.dbf文件的清空及轉移
(Oracle9i 或以上)
先確保沒有其他人或其他任務在進行數據庫操作
由于原來的temp文件已經占用了很大的空間,而且該磁盤內沒有足夠空間存入該文件。所以在清空原來的文件的基礎上,把該文件設定在另一磁盤內。
alter database tempfile '/opt/oracle/oradata/orcl/temp01.dbf' drop including datafiles;
alter tablespace temp add tempfile '/newplace/temp01.dbf' size 512M autoextend on next 250M maxsize unlimited;
新聞熱點
疑難解答