Home » Infrastructure » Linux » Deleting old Trace files (Oracle 10.2.0.3 Linux AS4)
Deleting old Trace files [message #396676] Tue, 07 April 2009 10:01 Go to next message
rsreddy28
Messages: 295
Registered: May 2007
Senior Member
Hi all,

I'm trying to delete all the older trace files in my Oracle server . The script works fine if I specify the instance and location of trace files for that instance but I have multiple instances in my server and I'm not knowing how and where to modify the script to remove all the trace files for all the databases in that server.

ex:I have 3 databases in my server like
dba1
dba2
dba3

and the location of the trace files are

find /opt/oracle/product/10.2.0/admin/dba1(Database Name)/bdump

So i want the script to automatically take each database one by one and remove the files accordingly.

Can you help me on this please.

Regards,
Raj
  • Attachment: script.txt
    (Size: 1.88KB, Downloaded 2160 times)
Re: Deleting old Trace files [message #396679 is a reply to message #396676] Tue, 07 April 2009 10:12 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
for db in dba1 dba2 dba3
do
  find /opt/oracle/product/10.2.0/admin/$db/bdump ...
done

Regards
Michel


[Updated on: Tue, 07 April 2009 10:13]

Report message to a moderator

Re: Deleting old Trace files [message #396713 is a reply to message #396676] Tue, 07 April 2009 16:25 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
Another option:

find /opt/oracle/product/10.2.0/admin/db[123]/bdump


Sorry, I just looked at your script you posted and your SID names may not lend themselves to using the method I provided above.

Are you stopping the listener prior to moving it's log file? If not, the listener would still have the old file handle open.

[Updated on: Tue, 07 April 2009 16:31]

Report message to a moderator

Re: Deleting old Trace files [message #396743 is a reply to message #396713] Tue, 07 April 2009 22:53 Go to previous messageGo to next message
rsreddy28
Messages: 295
Registered: May 2007
Senior Member
Hi ,

Thanks for that . I modified the script still , I'm able to clear all the trace files in all the database directories. But one more small area where I'm confused is I want to remove the contents of the alert log file and the listener log file which are more than 45 days in all the database directories.

Attached is the script, can someone look into that and help me out.

Raj
  • Attachment: cls.txt
    (Size: 1.86KB, Downloaded 2240 times)
Re: Deleting old Trace files [message #396748 is a reply to message #396676] Tue, 07 April 2009 23:19 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Attached is the script, can someone look into that and help me out.
How often or when does script run?

From my perspective, separate solutions for alert_SID.log & listener.log are required because listener.log is held open.
Re: Deleting old Trace files [message #396750 is a reply to message #396748] Tue, 07 April 2009 23:42 Go to previous messageGo to next message
rsreddy28
Messages: 295
Registered: May 2007
Senior Member
we are trying to put in the crontab and would run for evvry 1 week. I think we can have a small if loop condition by passing each instance 1 variable . But I'm not knowing how to run the if loop.

Any take on this , please
Re: Deleting old Trace files [message #396844 is a reply to message #396750] Wed, 08 April 2009 02:47 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
search the forum/google for "rotatelog" or "logrotate".
All you have to do is add an "mtime".
Search the forum. There are many examples.

[Updated on: Wed, 08 April 2009 02:49]

Report message to a moderator

Re: Deleting old Trace files [message #415106 is a reply to message #396676] Fri, 24 July 2009 17:08 Go to previous message
olddba
Messages: 5
Registered: June 2009
Location: Longview, Wa
Junior Member
try something like this for the trace files.
/usr/bin/find /opt/oracle/admin -name "*.trc" -mtime +7 -exec rm {} \;

I would check out logrotate for the listener log and alert logs.
Previous Topic: Sleep function
Next Topic: Oracle Installation Error - Exception Name: MakefileException
Goto Forum:
  


Current Time: Fri Apr 19 14:29:11 CDT 2024