Archive and restore by named pipe
Posted in 2000
Topics: Backup & Restore, Stored Procedures & SPL, Server Administration, Platform-Specific Issues
Hello
I'm looking for a solution to avoid the use of a tape drive for
archiving Informix by ontape.
I have tested, that only archives less than 2GB can be used without
problems, but my archive is about 3 GB and it's growing.
I have tested the way by using a named pipe as a TAPEDEV.
Tape section of onconfig.
TAPEDEV /tmp/ontape.nmp # Tape device path
TAPEBLK 1024 # Tape block size (Kbytes)
TAPESIZE 4096000
my archive script:
#!/bin/ksh
PIPE=/tmp/ontape.nmp
FN=/dbms/informix/ontape.`date +"%Y%m%d"`
MAXSIZE=500m
export MAXSIZE PIPE FN
rm $PIPE
mknod $PIPE p
( /usr/local/bin/gzip < $PIPE ) | split -b $MAXSIZE - $FN. &
echo "\\ny" | ontape -s -L 0 >> /tmp/nmpbkup.log
# end of archive script
my restore script:
#!/bin/ksh
PIPE=/tmp/ontape.nmp
FN=/dbms/informix/ontape.`date +"%Y%m%d"`
export PIPE FN
cat `echo $FN.* | sort` | /usr/local/bin/gunzip > $PIPE &
echo "\\ny\\nn\\nn\\n" | ontape -r
# end of restore script
But always the physical restore failed by restoring from named pipe !!!
The archive seems to be OK.
By unzipping instead of $PIPE into a file, the restore is OK.
It seems to be a problem with TAPEBLK ...
I am using Informix Dynamic Server Version 7.30.UC8 for AIX 4.2.1
Can anybody help me ?
If you want to back up to disk, why not to raw disk?
Juerg Schaer wrote in message <387633CC.BC66A58F@imtf.ch>...
>Hello
>
>I'm looking for a solution to avoid the use of a tape drive for
>archiving Informix by ontape.
>I have tested, that only archives less than 2GB can be used without
>problems, but my archive is about 3 GB and it's growing.
>I have tested the way by using a named pipe as a TAPEDEV.
>
>Tape section of onconfig.
>TAPEDEV /tmp/ontape.nmp # Tape device path
>TAPEBLK 1024 # Tape block size (Kbytes)
>TAPESIZE 4096000>
>my archive script:
>#!/bin/ksh
>PIPE=/tmp/ontape.nmp
>FN=/dbms/informix/ontape.`date +"%Y%m%d"`
>MAXSIZE=500m
>export MAXSIZE PIPE FN
>
>rm $PIPE
>mknod $PIPE p
>
>( /usr/local/bin/gzip < $PIPE ) | split -b $MAXSIZE - $FN. &
>
>echo "\\ny" | ontape -s -L 0 >> /tmp/nmpbkup.log
># end of archive script
>
>my restore script:
>#!/bin/ksh
>PIPE=/tmp/ontape.nmp
>FN=/dbms/informix/ontape.`date +"%Y%m%d"`
>export PIPE FN
>
>cat `echo $FN.* | sort` | /usr/local/bin/gunzip > $PIPE &
>echo "\\ny\\nn\\nn\\n" | ontape -r
># end of restore script
>
>But always the physical restore failed by restoring from named pipe !!!
>The archive seems to be OK.
>By unzipping instead of $PIPE into a file, the restore is OK.
>It seems to be a problem with TAPEBLK ...
>
>I am using Informix Dynamic Server Version 7.30.UC8 for AIX 4.2.1
>
>Can anybody help me ?
>
>
>
The problem is in the way that ontape reads the backup media. It first reads
the header off the media, then closes the file descriptor, expecting the media
to "rewind" (this is why you cannot usually use no-rewind devices with ontape).
It then rereads it from the beginning for the physical restore. Because your
pipe cannot be "rewound", after it closes the fd and reopens it, it reads data
that is not (now) a valid header, so the restore fails.
Theoretically, if you could send two copies of the header to the pipe during the
restore, it should work. Offhand, I don't know how long the header is. You
could probably do a dd & od and figure out how many bytes make up the header and
then put a kludge in your script to send the header twice.
Dave
Also sprach Juerg Schaer <jsc@imtf.ch> :
:Hello
:
:I'm looking for a solution to avoid the use of a tape drive for
:archiving Informix by ontape.
:I have tested, that only archives less than 2GB can be used without
:problems, but my archive is about 3 GB and it's growing.
:I have tested the way by using a named pipe as a TAPEDEV.
:
:Tape section of onconfig.
:TAPEDEV /tmp/ontape.nmp # Tape device path
:TAPEBLK 1024 # Tape block size (Kbytes)
:TAPESIZE 4096000
:
:my archive script:
:#!/bin/ksh
:PIPE=/tmp/ontape.nmp
:FN=/dbms/informix/ontape.`date +"%Y%m%d"`
:MAXSIZE=500m
:export MAXSIZE PIPE FN
:
:rm $PIPE
:mknod $PIPE p
:
:( /usr/local/bin/gzip < $PIPE ) | split -b $MAXSIZE - $FN. &
:
:echo "\\ny" | ontape -s -L 0 >> /tmp/nmpbkup.log
:# end of archive script
:
:my restore script:
:#!/bin/ksh
:PIPE=/tmp/ontape.nmp
:FN=/dbms/informix/ontape.`date +"%Y%m%d"`
:export PIPE FN
:
:cat `echo $FN.* | sort` | /usr/local/bin/gunzip > $PIPE &
:echo "\\ny\\nn\\nn\\n" | ontape -r
:# end of restore script
:
:But always the physical restore failed by restoring from named pipe !!!
:The archive seems to be OK.
:By unzipping instead of $PIPE into a file, the restore is OK.
:It seems to be a problem with TAPEBLK ...
:
:I am using Informix Dynamic Server Version 7.30.UC8 for AIX 4.2.1
:
:Can anybody help me ?
:
:
We've been using the named pipe technique for quite some time in our
HPUX 10.2 environment. (7.24). On the server where the Level X
archive is kicked off, we have to kick it off twice and it picks up
where it left off.
Example Server A: Server B:
ontape -s -L 0 ontape -r SERVER A exits when SERVER B prompts to continue the restore
then
ontape -s -L 0 again continue where left off
- Rick
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!