I try to restore a database with ontape -r file_name like :
$INFORMIXDIR/bin/ontape -r <<file_name
y
n
n
n
file_name
The error that I get is if the server is offline is :" Physical restore
failed - function read archive backup failed code 1 errno 2".
Has anyone any idea how do I have write the commad do or what environement
variables do I have to set for that the restore work properly?
Thans a lot,
Carmen
sending to informix-list
What are expecting << file_name to do?
Informix will try to restore the data from the device or file defined by the
TAPEDEV parameter in the $INFORMIXDIR/etc/$ONCONFIG file.
So, if this is not set correctly, edit the $ONCONFIG file to set TAPEDEV to
file_name.
--
Neil Truby t:01932 724027
Director m:07798 811708
Ardenta Limited e:neil....@ardenta.com
onstat -r <<EOF
y
n
n
n
EOF
should work, but I wouldn't use it on a production system
--
Paul Watson #
Oninit Ltd # Growing old is mandatory
Tel: +44 1436 672201 # Growing up is optional
Fax: +44 1436 678693 #
Mob: +44 7818 003457 #
www.oninit.com #
onstat -r would be quite safe on a production system.
I wouldn't use ontape on one though ...
OK,OK :-)
Great laxative ...
"Carmen Constantinescu" <car...@wylog.com> wrote in message news:<bthi4v$ujm$1...@terabinaries.xmission.com>...
We run cold restores all the time without being there. Every night in
fact. The reason is that we like to refresh a development environment
with the latest production data in case there is a problem in
production that is related to current data.
Here is what you need to do:
1) Make sure your informix environment variables are set correctly.
$ONCONFIG, $PATH, INFORMIXDIR, and INFORMIXSERVER should all be
what they are when you run it interactively. (some of these may not be
since you are typing $INFORMIXDIR/bin/ontape, $INFORMIXDIR should be
in your PATH)
2) Make sure that your TAPEDEV variable is set correctly in the
corresponding ONCONFIG file.
I think you need to have a return for the load tape question so it
might need to read like below.
We use the same format but I always use:
ontape -r <<EOF
y
n
n
n
EOF
If this doesn't help post again and I'll find my script for this.
To create a reporting database once per week...
Once all the ontape stuff is finished don't forget to
a) Sit in a loop running onstat - and check the return
code each time.Wait for the server to reach quiescent
mode. This can take 45 mins.
b) onmode -m to move to Online mode.
Otherwise a reboot means another restore!
I had this working great for a customer a while back!
onbar/ontape whatever ..
FORCEOL=n
until onstat - | grep "On-Line" > /dev/null
do
echo "Off line" # ; sleep 20
onstat - | grep "[BQ][lu][oi][ce][ks]" > /dev/null && ( echo "\nServ blokd"
if [ x$FORCEOL = "xn" ] ; then
echo "Onlining.." ; onmode -m ; FORCEOL=y; sleep 240
else
echo "waiting to online " ; sleep 240
fi
)
onstat - # for comfort factor
sleep 60
done
This seems to work on our automated restore of live for testing.
I know the grep line looks like a load of boll*cks. But it works.
Tru64 5.1 and ksh
Colin Bull
c.b...@videonetworks.com
sending to informix-list
> Here is one I prepared earlier ---
>
> onbar/ontape whatever ..
> FORCEOL=n
> until onstat - | grep "On-Line" > /dev/null
> do
> echo "Off line" # ; sleep 20
> onstat - | grep "[BQ][lu][oi][ce][ks]" > /dev/null && ( echo
> "\nServ blokd"
> if [ x$FORCEOL = "xn" ] ; then
> echo "Onlining.." ; onmode -m ; FORCEOL=y;
> sleep 240
> else
> echo "waiting to online " ; sleep 240
> fi
> )
> onstat - # for comfort factor
> sleep 60
> done
>
> This seems to work on our automated restore of live for testing.
> I know the grep line looks like a load of boll*cks. But it
> works. Tru64 5.1 and ksh
'onstat -' sets the return code according to the server state ->
no need for boll*cking greps...
From the top of my head:
255 = server is offline ("Shared memory not initialized...")
5 = online
4 = some error
0..3 = several other states like quiescent, blocked etc. (don't
know exacly)
HTH
Christian
--
#include <std_disclaimer.h>
/* The opinions stated above are my own and not
necessarily those of my employer. */
That will make it a lot tidier, should be able to use a case statement.
I will revise next week sometime.
http://www.smooth1.demon.co.uk/ifaq06.htm#6.33
6.33 What status codes does onstat return?
On 21st May 1998 mds...@informix.com (Mark D. Stock) wrote:-
As a point of interest, you can check the current mode of IDS by checking
the status ($?) after onstat -.
The values returned by 'onstat -' are:
a.. -1 Offline
b.. 0 Initialisation
c.. 1 Quiescent
d.. 2 Recovery
e.. 3 Backup
f.. 4 Shutdown
g.. 5 Online
h.. 6 Abort
# ------------------------------------------------------------------
echo " ********************************************"
echo " * Tape Restore Utility (For Single Tape ) *"
echo " ********************************************"
# ------------------------------------------------------------------
echo " "
echo " Press Enter to Continue or CTRL-C to Abort \c"
read con
echo "Please wait Shutting Down Engine..."
echo "y\ny\n" | onmode -k
echo "\nPlease wait Restoring..."
echo "\ny\nn\nn\nn\n" | ontape -r
while true
do
engstatus=`onstat - | awk '{ print $5 } '`
case $engstatus in
*Fast) echo "Online Engine is Recovering...";
sleep 50;;
*On-Line) grantdba;
echo "Engine in Online Mode....Ready to Use...";
exit;;
*Quiescent) echo "Engine is Quescient mode... Making Online";
cd etc;
onmode -m;
cp onconfig.null onconfig;
ontape -s -L 0 -B prime;
cp onconfig.tape onconfig;
cd;;
*for) echo "Engine is Off Line.. Starting Engine";
oninit;
exit;;
*) echo "Cannot find Engine Status..";
exit;;
esac
done
Carmen
sending to informix-list
> Here is my cute little code..
Most people just show pictures of their kids. Still, if it makes you
happy...
--
"C'est pas parce qu'on n'a rien à dire qu'il faut fermer sa gueule"
- Coluche
Apart from that, Carmen, how did you enjoy the play?