Skip to Main Content
  • Questions
  • Need to purge the hystorical custom data

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Rajesh.

Asked: August 13, 2022 - 12:31 am UTC

Last updated: August 16, 2022 - 2:50 am UTC

Version: 11.2.0.4.0

Viewed 1000+ times

You Asked

We have around 50 custom tables, which are using for the traces in db objects. Each table contains more than billion records.most of the tables don't have indexes. I want to delete data >sysdare-365 days. Which is not working it is taking very very long time. We can not go for renaming the table name. If we rename the table name, all our objects will be invalid.please suggest.

and Connor said...

Since you're on a very very old version....your options are limited.

Things you could look at:

1) dbms_parallel_execute. Lets you have lots of concurrent deletes all running at the same time. This speeds up the job, but of course, works your server a lot harder.

2) manual implementation of what dbms_redefintion does, ie

- create an mview log on your source table to capture changes
- create table new_table as select from old_table where date_col > sysdate-365;
- now take small outage where you
a) rename new_table to old_table
b) use the mview log to apply any outstanding changes

(2) is more work , but gives you the opportunity to look at partitioning as well, so you wont ever get into this problem again.

But I'd seriously look at upgrading first...because once you are on 19c (or anything above 12.2) you can simply do:

alter table T move online including rows where date_col > sysdate - 365

or even doing that *and* converting to partitioning at the same time. Here's a video showing that in action



which will run reasonably efficiently, but the table stays online during the entire process.


Is this answer out of date? If it is, please let us know via a Comment

More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database