![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Backup script | dan86 | Shell Programming and Scripting | 1 | 10-29-2007 05:47 PM |
| Backup Script | tayyabq8 | UNIX for Dummies Questions & Answers | 0 | 01-21-2006 02:09 AM |
| Shell script on Oracle hot backup got an error | oradbus | UNIX for Advanced & Expert Users | 1 | 01-03-2006 09:35 AM |
| DB2 Backup Script | jyoung | UNIX for Dummies Questions & Answers | 0 | 06-13-2005 09:59 AM |
| Help with a backup script | SemperFi | UNIX for Dummies Questions & Answers | 5 | 07-22-2004 08:00 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need help with oracle backup script
I have written a script to perfrom a cold backup on an oracle database. The script is failing everytime. Can anyone tell me what (stupid) error I am making.
The output from the uname command follows Linux rayora 2.2.14-6.1.1smp #1 SMP Thu Apr 13 19:55:55 EDT 2000 i686 unknown The error that I am getting on my script is: Oracle Server Manager Release 3.1.7.0.0 - Production Copyright (c) 1997, 1999, Oracle Corporation. All Rights Reserved. Oracle8i Enterprise Edition Release 8.1.7.0.1 - Production With the Partitioning option JServer Release 8.1.7.0.1 - Production SVRMGR> Connected. SVRMGR> Database closed. Database dismounted. ORACLE instance shut down. SVRMGR> Server Manager complete. /home/rf/bin/oracle_backup.sh: /home/rf/bin/oracle_backup.sh: line 53: syntax error: unexpected end of file The script that I wrote follows: Code:
#!/bin/sh
########################################################################
# Program Name - backup_full.sh #
# Purpose - To perform a cold backup of the Rayora database and the #
# Archive Logs #
# #
# Author - xxx.xxx.xxx #
# Date last Change - 09/14/2005 #
########################################################################
. /home/rf/common/cron_oracle_env.sh
LOG_FILE=/home/oracle/backup.log
########################################################################
# Execute the backup procedure #
########################################################################
echo `date +%c` >> $LOG_FILE
echo "Database RAYORA BACKUP starting." >> $LOG_FILE
svrmgrl <<EOT
connect internal
shutdown immediate
quit
EOT
if [ $? -eq 0 ]
then
echo "Database RAYORA shut down." >> $LOG_FILE
echo "Previous Backup is being removed." >> $LOG_FILE
touch /home/oracle/backup/junk
rm /home/oracle/backup/*
echo "Cold backup being performed." >> $LOG_FILE
cp -p -f -v /home/oracle/oraInventory/oradata/rayora/* /home/oracle/backup/
echo "Cold backup of archive logs being performed." >> $LOG_FILE
mv -f -v /home/oracle/oraInventory/oradata/arch/* /home/oracle/backup/
echo "Restarting Database RAYORA." >> $LOG_FILE
svrmgrl <<EOT
connect internal
startup
quit
EOT
if [ $? -eq 0 ]
then
echo "Database RAYORA started up." >> $LOG_FILE
else
echo "Database RAYORA will NOT start up." >> $LOG_FILE
fi
echo "Moving the backup files to the NFS share." >> $LOG_FILE
cp -p -f -v /home/oracle/backup/* /usr/local/backup/oracle_back/
echo "Remove Archive Logs older then seven (7) days" >> $LOG_FILE
find /usr/local/backup/oracle_back/ -type f -name "*arc" -mtime 6 -exec rm {}\;
else
echo "Database RAYORA failed to shut down." >> $LOG_FILE
fi
echo `date +%c` >> $LOG_FILE
echo "Database RAYORA BACKUP has completed." >> $LOG_FILE
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
You failed in the "EOT" after the "shutdown immediate" :
svrmgrl <<EOT connect internal shutdown immediate quit EOT Check if there is a space after "EOT". I also failed in the past due to blank space after EOT sign. Nir |
|
#3
|
|||
|
|||
|
I checked the script on the server and there are no spaces on the "EOT" line, either before or after the EOT. However there was a blank space after the "quit" on the previous line, will this cause problems?
|
|
#4
|
|||
|
|||
|
Maybe....
You don't need the "quit" at all. The EOT exits you from sqlplus/svrmgrl Nir |
|
#5
|
|||
|
|||
|
I have tried it with and without the quit
|
|
#6
|
|||
|
|||
|
Your script shows whitespace before EOT which needs to be removed. You indicated that you checked the script on the server but you CODE example shows whitespace. Recheck this since it will hork you up.
|
|
#7
|
|||
|
|||
|
I agree with tmarikle.
The EOT must be in the beginning of the line. Otherwise,you'll get syntax errors. Nir |
|||
| Google The UNIX and Linux Forums |
| Tags |
| linux, mtime |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|