Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Purging table which is having 98 M rows

748829Dec 2 2012 — edited Dec 6 2012
Hi,

I want to purge a table which is having more then 98M rows...here are the details...

Purge Process I followed
---------------------------------------------
Step 1. Created backup table from Main table with required data only
create table abc_98M_purge as
select * from abc_98M where trunc(tran_date)>='01-jul-2011'
-> table created with 5325411 rows

Step 2. truncate table abc_98M

Step 3. inserted all 5325411 rows back to abc_98M from abc_98M_purge using below procedure

DECLARE
TYPE ARRROWID IS TABLE OF ROWID INDEX BY BINARY_INTEGER;
tbrows ARRROWID;
row PLS_INTEGER;
cursor cur_insert is select rowid from abc_98M_purge order by rowid;
BEGIN
open cur_insert;
loop
fetch cur_insert bulk collect into tbrows limit 50000;
FORALL row IN 1 .. tbrows.count()
insert into abc_98M select * from abc_98M_purge where rowid = tbrows(row);
commit;
exit when cur_insert%notfound;
end loop;
close cur_insert;
END;

Problem
-----------------------------
It took 4 hours to insert 5325411 rows by Step 3.

Please suggest better approach, so that my downtime will reduce.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 3 2013
Added on Dec 2 2012
16 comments
431 views