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

  • From: Seth Miller <sethmiller.sm@xxxxxxxxx>
  • To: dmarc-noreply@xxxxxxxxxxxxx
  • Date: Wed, 10 Jun 2015 13:24:02 -0500

I find it interesting that with all of the responses you got, you
implemented none of the recommendations.

On Wed, Jun 10, 2015 at 3:17 AM, Mostafa Eletriby <
dmarc-noreply@xxxxxxxxxxxxx> wrote:

Hello ,
Thanks for all your support.

I performed the required cron job using
[root@Abohamad trace]# crontab -e

[root@Abohamad trace]# crontab -l
30 16 * * * /opt/maintain-traces
00,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@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@Abohamad trace]#

[root@Abohamad trace]# cat /opt/maintain-traces-1
#!/usr/bin/ksh
/bin/rm -rf /opt/oracle/base/diag/rdbms/cdsdb/cdsdb/trace/cdmp*
[root@Abohamad trace]#
[root@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 <
rjoralist3@xxxxxxxxxxxxxxxxxxxxx> 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...

Rich

--
//www.freelists.org/webpage/oracle-l





Other related posts: