Re: cron job at linux to remove trace and audit files

From: Mostafa Eletriby <>
Date: Wed, 10 Jun 2015 08:17:14 +0000
Message-ID: <>

Hello ,Thanks for all your support.
I performed the required cron job using [root_at_Abohamad trace]# crontab -e [root_at_Abohamad trace]# crontab -l
30 16 * * * /opt/maintain-traces00,05,10,15,20,25,30,35,40,45,50,55 * * * *  /opt/maintain-traces-1

I created two scripts with different schedules as shown below and it worked successfully.

[root_at_Abohamad trace]# cat /opt/maintain-traces#!/usr/bin/ksh/bin/rm -rf /opt/oracle/base/diag/rdbms/cdsdb/cdsdb/trace/*.trc/bin/rm -rf /opt/oracle/base/diag/rdbms/cdsdb/cdsdb/trace/*.trm
#/bin/rm -rf /opt/oracle/base/diag/rdbms/cdsdb/cdsdb/trace/cdmp*
/bin/rm -rf /opt/oracle/base/admin/cdsdb/adump/*.aud
[root_at_Abohamad trace]#
[root_at_Abohamad trace]# cat /opt/maintain-traces-1 #!/usr/bin/ksh/bin/rm -rf /opt/oracle/base/diag/rdbms/cdsdb/cdsdb/trace/cdmp* [root_at_Abohamad trace]#[root_at_Abohamad trace]# I think it will be better to use oracle user and good idea to remove traces larger than 10M, Currently I scheduled to remove traces for *.trc , *.trm , *.aud every day at 4;30 pm.All cron jobs will be a temporary solution until database upgrade will be performed to solve this bug. Thanks a lot for you all.Regards,Mostafa Eletriby  

     On Tuesday, June 9, 2015 8:25 PM, Rich Jesse <> wrote:    

 > Something else that no-one has yet mentioned...  I had an instinctive and
> visceral knee jerk reaction when I saw 'rm -rf' running as root.
> Is there any reason it has to run as root and not the database user?

The paranoid in me was wondering of potential issues where trace files of active processes are wiped.  Maybe something bad, maybe nothing, or maybe something in between like the file is inaccessible from the directory, but is still able to be written to by the Oracle process and therefore still taking up space.

If it's large individual trace files, maybe a better approach is to use 'find':

find $ADR_HOME/subdir/subdir -name "*.trc" -size +10M

...will only delete trace files larger than 10MB.  Standard disclaimer applies.

Just a thought...



Received on Wed Jun 10 2015 - 10:17:14 CEST

Original text of this message