How to prune Alert Log file & Background Trace Files? (UNIX system) [message #60235] |
Mon, 26 January 2004 22:47 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Patrick Tahiri
Messages: 119 Registered: January 2004
|
Senior Member |
|
|
Hi,
I have a large Alert Log file and I would like to know what are the UNIX commands to delete/prune a part of this Log file? I want to "erase"/prune of course the oldest part and hold the most recent written part of this log file!
I could use vi, and then select an area and delete it, but the file is so large, it will take too much time!
Thank you very much in advance!
Regards,
Patrick Tahiri.
|
|
|
|
Re: How to prune Alert Log file & Background Trace Files? (UNIX system) [message #60245 is a reply to message #60239] |
Tue, 27 January 2004 05:13 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Sanjay
Messages: 236 Registered: July 2000
|
Senior Member |
|
|
Wow ... easy on that command...
Here is what I do. Periodically, I rename the log files (with an easy date stamp) and keep for about a month. Also delete really old trace files...
1. cd $ORACLE_HOME/rdbms/log
2. mv alert_SID.log alert_SID_20040127.log
3. touch alert_SID.log
I do this as needed, or you can do it evey Monday or something... In this manner, the file size also stays small.
As for UDUMP dest files, delete the old ones as needed. (more than 90 days ?)
NOTE: you can do the same with the listener.log file.
Cheers.
|
|
|
Re: How to prune Alert Log file & Background Trace Files? (UNIX system) [message #60252 is a reply to message #60235] |
Tue, 27 January 2004 08:43 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Thiru
Messages: 1089 Registered: May 2002
|
Senior Member |
|
|
Patrick,
if you want to retain the last say 1000 lines, you could tail it ..
mv alert[[SID]].log alert[[SID]]_[[DATE]].log
tail -1000 alert[[SID]]_[[DATE]].log > alert[[SID]].log
Now you are left with a backup alert.log file that you can move to tapes and an active alert.log file that has the latest 1000 lines.. there are other ways too(like limiting to a certain size or the last 1 month and so on)..
|
|
|
|
|