Re: Unattended online archival
Posted in 1994
psampat@cronkite.ocis.temple.edu (Pragnesh Sampat) writes:
> Hi, I would like some information on the best way to set up unattended
> (through cron) Informix database achival.
>
> I am running Informix OnLine 5.01 on a Sparc 1000 running Solaris 2.3. My
> dbspaces are on raw disks.
>
> I would like to setup nightly archival of my databases through cron. I know
> that Informix manual suggests that "tbtape" is an interactive program and
> should not be run in background mode. Here is what I have done,
>
> (this is a simplified version)
> *******************************************************************
>
> mt -f /dev/rmt/0 stat
> if [ $? != 0 ]
> echo "Error!!!!!!!"
> exit
> fi
>
> tbtape -s << END >> ${LOG} 2>&1
> ^M # "RETURN" for tape ready
> 0 # level 0
> END
>
> *******************************************************************
>
>
> There are two problems with this
>
> 1> tbtape keeps on writing ^M into my log file and thus my log file becomes
> unreadable
>
> 2> Inspite of checking status of tape drive with "mt" command tbtape
> encounters a strange error (Error 16 - mount busy) and goes into an
> end less loop of writing error message into the log file, eventually
> filling up my file system and creating a lot of problems.
>
> So the question is whether I should fix my script or should I be using
> some different backup scheme all together (like tbunload or dbexport)?
Here are the last few lines of our fullback script that is run by cron
each night. The system is a SS/10 running Solaris 2.3 . Several notes:
1. We are backing up all our filesystems and the informix
database to one tape by using a norewind tape.
2. Since cron runs this script as root the 'su - informix -c' is
used to do the commands in quotes as informix. Yes, I know
this a security hole, but our DBA is also our sysadmin. If
you have seperate tape drives then the informix backup line
without the su to informix could be put into a script that
is run by cron as informix.
3. The echo is used to answer both the prompt for a tape and the
prompt for an archive level. Then use of /usr/5bin/echo allows
the use of '\\n'(A new line) to be in the string being echoed.
4. The pipe'ing of the output through mail allows the sysadmin
to check the results each day.
TAIL OF OUR /home/sysadmin/bin/fullback FOLLOWS:
#
# Note use of high-density no-rewind device.
#
DEVICE=/dev/rmt/0hn
#DEVICE=/dev/rmt/1hn
#
# Dump order is /var, /opt, /, /usr, then Informix raw data partition.
#
/usr/sbin/ufsdump 0uf $DEVICE /dev/md/rdsk/d3
/usr/sbin/ufsdump 0uf $DEVICE /dev/md/rdsk/d5
/usr/sbin/ufsdump 0uf $DEVICE /dev/md/rdsk/d1
/usr/sbin/ufsdump 0uf $DEVICE /dev/md/rdsk/d4
su - informix -c "/usr/5bin/echo '\\n0' | tbtape -s | mailx -s 'Informix Backup'
root"
mt -f $DEVICE offline
--
Daniel Wood daniel@starsight.com
The opinions expressed herein are those of myself, my employers, the carriers
of this news message or any other messages for that matter, you the reader and
any of your relations(whether by birth or chromosome count), all life forms
and all inanimate objects.