Wednesday, 4 November 2015

Example of find command in Oracle database / Delete log files older than a specific date

Below command help to delete old log files,trace files ,audit log files older than a specified date .

1. To display the files older than 5 days
 find  /u01/oracle/admin/diag/rdbms/islam01/trace/ -type f -name "*.trc"  -mtime +5 -execls -latrh {} \;

2. Delete the files older than 5 days
find  /u01/oracle/admin/diag/rdbms/islam01/trace/ -type f -name "*.trc"  -mtime +5 -exec rm -rf {} \;

Note: " /u01/oracle/admin/diag/rdbms/islam01/trace/"  is your log files location.

No comments:

Post a Comment