Monday, July 23, 2012

Cleaning Oracle logs / trace files / datafiles on the fly.

Regardless which OS you are using straight delete for Oracle logs / trace files / datafiles is not good option. Of course there is differences between files but usually these files used space is freed up only after database instance restart. So best way to clean these files is to make files size to zero. This way OS is freeing up the used space on the fly.

In *unix you can do it this way:
cat /dev/null > listener.log
and in the Windows you can copy zero size file over the orginal big size file.
When you are removing tablespaces do not use "and datafiles" clause in drop tablespace clause. Instead of that drop tablespace without "and datafiles" then change dropped tablespace datafiles sizes to zero (like above) from OS side.  And last you can delete datafiles from OS side after you have restarted database.

No comments:

Post a Comment