Delete rows from table where date

If you need to get rid of some table rows, in my case a Sun IDM logging table, you can use the following steps.

1. Create a backup in case you have done some thing wrong u can always revert back.

create table waveset.log_backup as select * from waveset.log;

2. Check if these are the records you want to keep and rest all delete.

select * from waveset.log_backup where repomod between'26-MAR-09' and '01-MAY-09';

3. Delete logging from timestamp type collumn ‘REPOMOD’ between dates:

delete from waveset.log_backup where repomod between'26-MAR-09' and '01-MAY-09';

4. if this works do the same on the real table instead of the backup table.

Optionally you can repeat the same trick on the waveset.syslog table, which also can grow to huge proportions.

[ad#ad-article-banner1]