Error of cleaning the dump file
467835Mar 18 2008 — edited Mar 24 2008Hi all experts,
My following scripts are giving me error. Our kindly feed back will be very helpful.
#!/bin/ksh
set -x
exec>/u01/oradata/kup_$$.log 2>&1
# How many days the dump files should be kept
days_back=5
# Add path variable to find the .oraenv command
PATH="$PATH:$ORACLE_HOME/bin"; export PATH
ORACLE_HOME=/u01/app/oracle/product/10.2; export ORACLE_HOME
ORACLE_SID=PPRD; export ORACLE_SID
# If a SID is provided as an argument it will be set and oraenv run
# Otherwise the current system SID can be used. If no SID is set or provided
# an error message is displayed and script exist with the status code 1
if [ $1 ]
then
ORACLE_SID=$1
ORAENV_ASK=NO
. oraenv
else
if [ ! $ORACLE_SID ]
then
echo "Error: No ORACLE_SID set or provided as an argument"
exit 1
fi
fi
# Set the ORACLE_BASE variable
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
# Clean the files matching both the names and modifid criteria
# Out of each directory with a fiind command with an execute clause
find $ORACLE_BASE/admin/$ORACLE_SID/adump/ -name "*.aud" -mtime+$days_back \-exec rm {} \;
find $ORACLE_BASE/admin/$ORACLE_SID/bdump/ -name "*.trc" -mtime+$days_back \-exec rm {} \;
find $ORACLE_BASE/admin/$ORACLE_SID/cdump/ -name "*.trc" -mtime+$days_back \-exec rm {} \;
find $ORACLE_BASE/admin/$ORACLE_SID/udump/ -name "*.trc" -mtime+$days_back \-exec rm {} \;
exit;
The error is below,
++ days_back=5
++ PATH=/usr/sbin:/usr/jdk/j2sdk1.4.2_15/bin:/usr/bin:/usr/local/bin:/usr/X/bin:/usr/sfw/bin:/opt/csw/bin:/opt/SUNWspro/bin:/opt/microfocus/cobol/bin:/usr/cc
s/bin:/usr/bin:/bin
++ export PATH
++ ORACLE_HOME=/u01/app/oracle/product/10.2
++ export ORACLE_HOME
++ ORACLE_SID=PPRD
++ export ORACLE_SID
++ '[' ']'
++ '[' '!' PPRD ']'
++ ORACLE_BASE=/u01/app/oracle
++ export ORACLE_BASE
++ find /u01/app/oracle/admin/PPRD/adump/ -name '*.aud' -mtime+5 -exec rm '{}' ';'
find: bad option -mtime+5find: [-H | -L] path-list predicate-list
++ find /u01/app/oracle/admin/PPRD/bdump/ -name '*.trc' -mtime+5 -exec rm '{}' ';'
find: bad option -mtime+5
find: [-H | -L] path-list predicate-list
++ find /u01/app/oracle/admin/PPRD/cdump/ -name '*.trc' -mtime+5 -exec rm '{}' ';'
find: bad option -mtime+5
find: [-H | -L] path-list predicate-list
++ find /u01/app/oracle/admin/PPRD/udump/ -name '*.trc' -mtime+5 -exec rm '{}' ';'
find: bad option -mtime+5
find: [-H | -L] path-list predicate-list
++ exit