Thursday, June 19, 2008

Delete logfile older date

In Oracle database there are some files which reguarly create day by day such as trace files, log files, archivelog files & Exported dump files.

In this article i will show how to remove above files as batch job.



Linux platform



We can use find command for this purpose.



for example:



find $TRACEFILE/* .trc -mtime +7 -exec rm {} \;



above script remove all .trc files which older than 7 days.



Schedule: Through crontab utility schedule above script.



For Reference



Windows platform



We can use FORFILES.exe for this purpose



find more about forfiles.exe



for example:



K:\FORFILES. EXE /P K:\archive_dump_ files -s /M *.* /D -5 /C "cmd /c del @FILE echo @FILE"



In above example files deleted older than 5 days from "archive_dump_ files" location.



Schedule: We can use WINDOWS SCHEDULER TASK for this purpose.

No comments: