Tag Archives: forfiles

Delete old files in Windows and Oracle

24 Jul

Oracle produces a lot of trace and log files. Take a backup of the files before renaming/removing them. For the trace files – it’s wise to keep 1-2 week of alert/trace files in the same directory. Here’s an example to create a bat-file which you can schedule to delete old files (older than 14 days:

forfiles /p D:\App\Oracle\diag\rdbms\ora01\ora01\alert\ /s /m *.* /D -14 /C “cmd /c del /F /Q @path”

Oracle will automatically create a new alert log files when you rename/delete existing file.

Read more

https://community.oracle.com/thread/3544775?start=0&tstart=0

http://dba.stackexchange.com/questions/15715/how-to-free-up-disk-space-which-logs-directories-to-clean

https://community.oracle.com/thread/2297940?tstart=0

http://ss64.com/nt/forfiles.html

http://ss64.com/nt/del.html

http://stackoverflow.com/questions/51054/batch-file-to-delete-files-older-than-n-days

https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:402360068979

http://dba-masters.blogspot.no/2012/08/11g-r2-trace-files-and-alert-logs.html

http://stackoverflow.com/questions/7160342/how-to-skip-are-you-sure-y-n-when-deleting-files-in-batch-files

http://www.databasejournal.com/features/oracle/article.php/3875896/Purging-Oracle-Databases-Alert-Log-with-ADRCI—Usage-and-Warning.htm