ORA-01562: failed to extend rollback segment number 11

oracleplsql

I´m trying to execute this query into a SP

 DELETE FROM table SC
      WHERE SC.evaluationMonth= 'Some month';
 COMMIT;

But for this month there are something like 10 million records. So I get the error

ORA-01562: failed to extend rollback segment number 11.

How can I improve the SP or make something to solve this problem?
Pdta: I had increase de unto to 20G

Best Answer

When you delete data, oracle save delete data because perhaps transaction don't ends with commit and oracle need to restore delete data.

This copy of data is stored in rollback segments. In Oracle settings you have max extends for this segments.

Solution

  • You can extend segments
  • You can delete data by 'slices':

Sample spliting delete data:

 DELETE FROM table SC
 WHERE SC.evaluationMonth= 'Some month' 
 and SC.evaluationDay= '1';
 COMMIT;

 DELETE FROM table SC
 WHERE SC.evaluationMonth= 'Some month' 
 and SC.evaluationDay= '2';
 COMMIT;

 ...

 DELETE FROM table SC
 WHERE SC.evaluationMonth= 'Some month' 
 and SC.evaluationDay= '31';
 COMMIT;

(you can do a loop, of course )