Question : Deleting a large number of records from Oracle

I need to delete a large number of records from Oracle 10g  (close to 50 million). The process takes a very long time anyway; once it is done for some reason the Oracle DB really slows down. The response times are really really poor after the deletion process. I am a newbie to Oracle and SQL. Any suggestions on how to proceed?

Answer : Deleting a large number of records from Oracle

does it ever complete ?

1) why not you do it in batches ? something like

delete from table where updated_date < date and rownum < 25001;
commit;

then again we can do the same thing until it deletes everything. batch size is just an example to make you understand. you can determine the correct batch size by executing it with 50K or 10K etc and you find it that works quick and should be fine.

2) is there an index for the updated_date column in your table ?

3) after deletion, if you will have only little count of records in that table then why not take only those records to some other table and then truncate this table and then put those records back into original table.

create table bak_table as select * from mytable where <<condition for all the required records>>;
truncate table mytable;
insert into mytable select * from bak_table;
commit;

Thanks
Random Solutions  
 
programming4us programming4us