Database Administration (MOSC)

MOSC Banner

scripts to move trace file

edited Apr 22, 2012 8:00PM in Database Administration (MOSC) 6 commentsAnswered
I am not sure if this is the correct forum to post my question. It's rather unix related, but it has to do with day to day oracle administration.

I wrote a korn shell script that will run on the first of each month and put the trace file from previous month to another folder.

cd /apps/oracle/diag/rdbms/test/test/trace

curmth=`date +%m`
set -A mth Dec Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
prevmth=${mth[$((curmth - 1))]}
curyr=`date '+%Y'`
mkdir trace_$prevmth$curyr
find /apps/oracle/diag/rdbms/test/test/trace -mtime +1  -name "*.[tt][rr][cm]" -exec mv {} /apps/oracle/diag/rdbms/test/test/trace/trace_$prevmth$curyr

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center