# 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
[
B]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[/B]
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]
Quote:
Originally Posted by
manna
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