The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
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

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-21-2005
Registered User
 

Join Date: Jul 2004
Location: New York State
Posts: 65
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
Reply With Quote
Forum Sponsor
  #2  
Old 09-21-2005
Registered User
 

Join Date: Jun 2004
Posts: 146
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
Reply With Quote
  #3  
Old 09-21-2005
Registered User
 

Join Date: Jul 2004
Location: New York State
Posts: 65
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?
Reply With Quote
  #4  
Old 09-21-2005
Registered User
 

Join Date: Jun 2004
Posts: 146
Maybe....
You don't need the "quit" at all.
The EOT exits you from sqlplus/svrmgrl

Nir
Reply With Quote
  #5  
Old 09-21-2005
Registered User
 

Join Date: Jul 2004
Location: New York State
Posts: 65
I have tried it with and without the quit
Reply With Quote
  #6  
Old 09-21-2005
Registered User
 

Join Date: Jan 2005
Posts: 682
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.
Reply With Quote
  #7  
Old 09-21-2005
Registered User
 

Join Date: Jun 2004
Posts: 146
I agree with tmarikle.
The EOT must be in the beginning of the line. Otherwise,you'll get syntax errors.

Nir
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux, mtime

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:03 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0