unexpected EOF

I ran the following scripts and everytime i get the errot as follows

Line 54: unexpected EOF while looking for matching ','
line 57 syntex error unexpected end of file#!/bin/ksh
set -x

BKUP_DIR=/u03/backups/abu/nightly_backup

LOG_FILE=/u03/backups/abu/backup.log

ORACLE_HOME= /u01/app/oracle/product/10.2; export ORACLE_HOME

ORACLE_SID=SEED; export ORACLE_SID
PATH="$PATH:$ORACLE_HOME/bin";export PATH
########################################################################
# Execute the backup procedure
#
########################################################################
echo ymd=`date +%Y%m%d` >> $LOG_FILE
echo "Database BACKUP starting." >> $LOG_FILE
ORACLE_HOME=/u01/app/oracle/product/10.2; export ORACLE_HOME

ORACLE_SID=SEED; export ORACLE_SID
PATH="$PATH:$ORACLE_HOME/bin";export PATH
rman target=/ << EOF

shutdown immediate

EOF

if [ $? -eq 0 ]
then
mkdir -p ${BKUP_DIR} # make directory
echo "Database shut down.">> $LOG_FILE
else echo "not shutdown".>> $LOG_FILE

fi

if [ ! -d ${BKUP_DIR} ]
then

echo "Not a directory: ${BKUP_DIR}">> $LOG_FILE
exit 1
fi

echo "Previous Backup is being removed." >> $LOG_FILE
rm ${BKUP_DIR}/${ymd-${seed}.gz >>$LOG_FILE
echo "Cold backup being performed." >> $LOG_FILE

cp /u01/app/oracle/admin/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz #copying database files into new dir
cp /u02/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
cp /u03/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
echo "Cold backup of archive logs being performed." >> $LOG_FILE

mv /u01/app/oracle/product/10.2/dbs/arch/* ${BKUP_DIR}/$ymd-${cmsv}.gz
gzip ${BKUP_DIR}/$ymd-${cmsv}
echo "Restarting Database" >> $LOG_FILE
rman target=/ << EOF
startup
EOF
else
echo "Database will NOT start up." >> $LOG_FILE
fi
echo 'ymd='date +%Y%m%d' >> $LOG_FILE

echo "Database BACKUP has completed." >> $LOG_FILE

exit

Please help

Take out all the single ticks and put $(...) around the date command.

echo ymd=$(date +%Y%m%d) >> $LOG_FILE

The script above has absolutely no leading spaces. Is that really how the script looks, or was the formatting the result of cut-and-paste? I ask because the EOF terminator must be exactly that and no more:

   cat <<EOF
   This works!
EOF

   cat <<EOF
   This won't recognize the EOF below because of the leading spaces!
   EOF

   cat <<-EOF
         Ah-ha, but the dash before EOF will strip leading tabs (from text and the EOF)
         EOF


Of course, you also have mismatched backticks in your last "date" command:


echo 'ymd='date +%Y%m%d' >> $LOG_FILE

You don't need them at all! Try this:

date "+ymd=%Y%m%d" >> $LOG_FILE

Using backticks or $( ) should be functionally equivilant, although I find the latter easier to read.

It says unexpected end of file while looking for matching '{' in line 42
Syntex error in line 57 unexpected end of file. I followed the direction of you guys but it still getting error. I am actually trying to create seperate directory where i will dump alll database files everyday after it shut down. The directory name should be ymd format. I created the scripts as you can see. Just give me suggestions whether i can do any other way. I am new to UNIX. I appreciate your suggestions.

Please help

Yep, another typo:

    rm ${BKUP_DIR}/${ymd-${seed}.gz >>$LOG_FILE
should be
    rm ${BKUP_DIR}/${ymd}-${seed}.gz >>$LOG_FILE

Proofread. The error output should have been a hint.

Please put your code inside code tags, like this:

It makes it much easier to read, and easier to give assistance.

# This is my code

BKUP_DIR=/u03/backups/abu/nightly_backup
LOG_FILE=/u03/backups/abu/backup.log
ORACLE_HOME= /u01/app/oracle/product/10.2; export ORACLE_HOME
ORACLE_SID=SEED; export ORACLE_SID
PATH="$PATH:$ORACLE_HOME/bin";export PATH
########################################################################
# Execute the backup procedure
#
########################################################################
echo ymd=`date +%Y%m%d` >> $LOG_FILE
echo "Database BACKUP starting." >> $LOG_FILE
ORACLE_HOME=/u01/app/oracle/product/10.2; export ORACLE_HOME
ORACLE_SID=SEED; export ORACLE_SID
PATH="$PATH:$ORACLE_HOME/bin";export PATH
rman target=/ << EOF
shutdown immediate
EOF

if [ $? -eq 0 ]
then
mkdir -p ${BKUP_DIR} # make directory
echo "Database shut down.">> $LOG_FILE
else echo "not shutdown".>> $LOG_FILE
fi
if [ ! -d ${BKUP_DIR} ]
then
echo "Not a directory: ${BKUP_DIR}">> $LOG_FILE
exit 1
fi
echo "Previous Backup is being removed." >> $LOG_FILE
rm ${BKUP_DIR}/${ymd-${seed}.gz >>$LOG_FILE
echo "Cold backup being performed." >> $LOG_FILE

cp /u01/app/oracle/admin/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz #copying database files into new dir
cp /u02/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
cp /u03/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
echo "Cold backup of archive logs being performed." >> $LOG_FILE

mv /u01/app/oracle/product/10.2/dbs/arch/* ${BKUP_DIR}/$ymd-${cmsv}.gz
gzip ${BKUP_DIR}/$ymd-${cmsv}
echo "Restarting Database" >> $LOG_FILE
rman target=/ << EOF
startup
EOF
else
echo "Database will NOT start up." >> $LOG_FILE
fi
echo 'ymd='date +%Y%m%d' >> $LOG_FILE

echo "Database BACKUP has completed." >> $LOG_FILE

exit
[/quote]

Please help

Please do not bump up your threads to get more attention. See the forum rules:

For faster assistance, please make use of the suggestions already given, and use the formatting requested.