It is currently Sat, 04 Dec 2021 18:52:02 GMT



 
Author Message
 backup script problems... need help
Could some one please tell me what is wrong in this script ? It is a script
written to backup oracle database. It works when the ' write results of this
script code' is commented out.
Any help is appreciated. Thanks in advance for help.
regards,
Dan
Complete script to follow
------------------

#!/bin/ksh
# Perform full back for the current instance
#
DESTINATION=/u02/backup/dti
export DESTINATION
#
echo echo ""
echo "Database name -->" $ORACLE_SID
echo ""
echo "Destination ---->" $DESTINATION
echo ""

echo "Is this imformation correct? (y/n)"
read answer
if [ $answer = "n" ]
then
   echo "try again ..."
   exit
fi

# Write the results of this script to 'make.result' in the
# current directory as well as to the screen.
ksh << EOF 2>&1
#

echo "DESTINATION="$DESTINATION

echo "\n\nShuting down $ORACLE_SID database ...\n"
svrmgrl << EOD
   connect internal
   shutdown immediate
   disconnect
EOD

echo ""
for file in /u0*/oradata/dti/*.log
do
   echo "Copying $file to $DESTINATION ..."
   cp -p $file $DESTINATION
done

echo "\n\nStarting up $ORACLE_SID database ...\n"
svrmgrl << EOD
   connect internal
   startup
   disconnect
EOD

echo ""
echo "Backup is done!!!"
echo ""
# Establish the end of the self-logging script.
EOF



 Sun, 20 Jul 2003 05:01:01 GMT   
 backup script problems... need help
Sorry the earlier post did not have the complete script.
Here it is.
Regards,
Dan

Complete Script
_________

#!/bin/ksh
# Perform full back for the current instance
#
DESTINATION=/u02/backup/dti
export DESTINATION
#
echo echo ""
echo "Database name -->" $ORACLE_SID
echo ""
echo "Destination ---->" $DESTINATION
echo ""

echo "Is this imformation correct? (y/n)"
read answer
if [ $answer = "n" ]
then
   echo "try again ..."
   exit
fi

# Write the results of this script to 'make.result' in the
# current directory as well as to the screen.
ksh << EOF 2>&1 | tee bkup_cold.log
#

echo "DESTINATION="$DESTINATION

echo "\n\nShuting down $ORACLE_SID database ...\n"
svrmgrl << EOD
   connect internal
   shutdown immediate
   disconnect
EOD

echo ""
for file in /u0*/oradata/dti/*.log
do
   echo "Copying $file to $DESTINATION ..."
   cp -p $file $DESTINATION
done

echo "\n\nStarting up $ORACLE_SID database ...\n"
svrmgrl << EOD
   connect internal
   startup
   disconnect
EOD

echo ""
echo "Backup is done!!!"
echo ""
# Establish the end of the self-logging script.
EOF



 Sun, 20 Jul 2003 06:06:27 GMT   
 backup script problems... need help

Where it says:
ksh <<EOF 2>&1
change this to:
ksh <<'EOF' 2>&1
otherwise, in the "for file" loop, the variable $file gets substituted
before the loop is executed.



 Sun, 20 Jul 2003 06:35:07 GMT   
 backup script problems... need help
Thanks Bill. The script works fine now
Dan

news:3a77400f$1_2@news.iglou.com...



 Sun, 20 Jul 2003 06:56:52 GMT   
 backup script problems... need help
Call me dense, but why does that make a difference?  I know that a 'here'
document EOD marker can be a variable, but why does that affect the for
loop?

news:UEHd6.3029$Nq6.114719@news.flash.net...



 Sun, 20 Jul 2003 22:22:38 GMT   
 backup script problems... need help

<740DDD49D98BB60C.70C1EEB73A1FC31A.F7A0812C2083D...@lp.airnews.net>...
As it is explained in `man $SHELL`, if the marker is not quoted, any
variables in the here-document are substituted when the document is read.
The result is similar to using double quotes instead of single with a
sed or awk command.



 Mon, 21 Jul 2003 06:47:37 GMT   
 backup script problems... need help

news:3a78947a$1_2@news.iglou.com...

Um, thanks for the reply, but don't you think that most people in this NG
would have looked in the man page for their shell _BEFORE_ posting that kind
of question?  That maybe it wasn't explained (or explained clearly) on
_their_ system?  Don't assume that whatever brand of Unix you use is the
only one that everyone else uses.  On my AIX systems, the 'ksh' man pages
don't mention anything at all about the 'here' document syntax.  It turns
out the documentation is there, but buried somewhat, so a condescending
reference to the man pages don't apply.  You may not want to assume that
everyone that posts a question is too stupid or too lazy to look it up
themselves beforehand; that leads to flame wars.



 Mon, 21 Jul 2003 22:18:36 GMT   
 
   [ 7 post ] 

Similar Threads

1. Help - Looking For Backup Scripts - Backup 1.0 Problems

2. Cron script needed to make backups - help please

3. [Q} need help on shell script for backup?

4. Help needed for modify backup log scripts

5. need help on backup script ???

6. need help with a Backup and restore script

7. Help with backup script needed.

8. afio backup scripts incremental backup problem

9. Incremental backup script problems, please help


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software