Deleting large number of records
454379Apr 13 2006 — edited Jun 16 2011Hello all,
The problem of deleting large amount of data from database appeared several times in the forum, but none of them reflects my problem.
I have a table which is appended of ca. 1 700 000 records every day. Every day should also be oldest records deleted, ca. 1 700 000 of them. Total number of records in this table is constant, ca. 0,6 billion. There is no dependency between this table and any other Oracle object, and the only operations performed on this table is adding new records, removing oldest and selecting them. One column of this table is indexed, so adding of removing data takes some time to update index. But it is not the issue.
The problem is in deleting oldest records. When I simply issue a DELETE command I get a message that undo tablespace is to small, transaction rollback will not be possible and therefore records cannot be deleted. This is normal and expected effect, because Oracle general philosophy is full data recovery. But in my particular case this recovery policy is not needed. I simply want to irrecoverably delete large amount of data. If something happens during transaction then this is not a problem, because such failed operation can be easily corrected on application (not Oracle) level.
I couldn't find in the web how to "switch off" rollback, undo, or whatever it is called. Oracle gurus told me that probably it is not possible and the only solution is to increase undo tablespace. But I can't believe that there is no such mechanism in Oracle that allows ultimate and irrecoverable data deletion. Deleting records in smaller sets, by 100 000 for example, takes too long because indexes must be updated after every commit. In the ideal case I would like oldest records to be deleted, then added new ones, and finally updated index and committed the whole operation.
Do you have any idea how to achieve this? Or should I organize my data in a different way?
Any hints will be greatly appreciated.
Greg