backup script problems... need help

backup script problems... need help

Post by DT » Thu, 01 Feb 2001 06:01:01



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

 
 
 

backup script problems... need help

Post by DT » Thu, 01 Feb 2001 07:06:27


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

 
 
 

backup script problems... need help

Post by Bill Marcu » Thu, 01 Feb 2001 07:35:07



>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

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.
 
 
 

backup script problems... need help

Post by DT » Thu, 01 Feb 2001 07:56:52


Thanks Bill. The script works fine now
Dan



> >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

> 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.

 
 
 

backup script problems... need help

Post by F. Michael Or » Thu, 01 Feb 2001 23:22:38


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?


> Thanks Bill. The script works fine now
> Dan




> > >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

> > 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.

 
 
 

backup script problems... need help

Post by Bill Marcu » Fri, 02 Feb 2001 07:47:37



Quote:>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?

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.
 
 
 

backup script problems... need help

Post by F. Michael Or » Fri, 02 Feb 2001 23:18:36





> >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?

> 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.

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.
 
 
 

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

I have backup-1.0 from sunsite.  But it never completes from CROND.
Always hangs.  Can anyone suggest decent backup procedures for
a dat drive?

Thanks

--

New Jersey Computer Connection - Public Access Unix Site - pluto.njcc.com
Voice: 609-896-2799 - Fax: 609-896-2994 - Dialups: 609-896-3191
Dialup or Telnet to pluto.njcc.com and log in as guest for more information.

2. HELP: How to change SCSI ID of HBA..........................................TIA

3. need help with a Backup and restore script

4. Top for the DG Aviion

5. Cron script needed to make backups - help please

6. problem with fips

7. Help with backup script needed.

8. pb: M$ wheel mouse under X

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

10. need help on backup script ???

11. Help needed for modify backup log scripts

12. afio backup scripts incremental backup problem

13. Incremental backup script problems, please help