Oracle刪除資料減少IO的方法

2021-08-22 15:29:47 字數 468 閱讀 3919

今天有個表有很多資料需要刪除,dba很忙,我就自己動手了

delete from crm_customer t where t.corporation_id in (***,***,***,***.......***);

執行後發現資料庫的cpu都消耗在了iowait上面,我還以為是別人也在用這台機器作壓力測試呢,東打聽西打聽沒發現問題,結果dba乙個**打來,說刪除資料要這麼做:

begin

for i in 90000018 .. 90000151 loop

delete from crm_customer t where t.corporation_id = i;

commit;

end loop;

end;

而我那樣做要回滾的資料太多,io要求很高。

哈哈,又學了一手

oracle刪除資料

oracle在表中刪除資料的語法是 語法結構 delete from表名 where 條件 演示 sql delete from infos where stuid s100103 1 row deleted sql commit truncate 在資料庫操作中,truncate命令 是乙個ddl...

oracle刪除資料後的恢復

要達到刪除資料,有以下幾種方式都可以 1 delete 2 drop乙個表 3 truncate乙個表 重要的不是怎麼刪除乙個表,而是誤刪除資料後怎麼立即恢復 不考慮全庫備份和利用歸檔 日誌 對於delete方法,可以利用oracle提供的閃回方法 如果在刪除資料後還沒做大量的操作 只要保證被刪除資...

oracle刪除資料後的恢復

要達到刪除資料,有以下幾種方式都可以 a 確定刪除資料的時間 在刪除資料之前的時間就行,不過最好是刪除資料的時間點 b 用以下語句找出刪除的資料 select from 表名 as of timestamp to timestamp 刪除時間點 yyyy mm dd hh24 mi ss c 把刪除...