Hey all!
Just a quickie and useful thing today. How many times you found this?
/bin/rm: cannot execute [Argument list too long]
Ok, so, first thing: Is it related to Oracle logs? If so, you may want to ADCRI. Check this post for more info: ADRCI Retention Policy and Ad-Hoc Purge Script for all Bases.
If not, you may solve this using find with rm. Ok, but want to keep the most recent files?
Some examples for you, removing audit files:
# Remove older then 1 day:
find /oracle/greporadb/admin/greporadb/adump -name "*.aud" -mtime +1 -exec rm {} \;
# Remove older then 1 hour:
find /oracle/greporadb/admin/greporadb/adump -name "*.aud" -cmin +60 -exec rm {} \;
Use it carefully to don’t remove important files. And use proper tools if possible, like ADRCI or RMAN.
To remove archivelogs, for example, try do use RMAN for this and avoid deleting unbacked files. A quick example:
RMAN> DELETE ARCHIVELOG ALL COMPLETED BEFORE 'sysdate-1' BACKED UP X TIMES to [disk|tape]; -- To delete all including those with no backup: RMAN> DELETE ARCHIVELOG ALL COMPLETED BEFORE 'sysdate-1';
Anyway, use carefully.
This use to help me. Hope it helps you too.
Cheers!