Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

database restore with ontape -r on Informix Online Dynamic Server 7.31 on Linux

199 views
Skip to first unread message

Carmen Constantinescu

unread,
Jan 7, 2004, 12:36:18 PM1/7/04
to

Please help!

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

Neil Truby

unread,
Jan 7, 2004, 1:16:51 PM1/7/04
to
"Carmen Constantinescu" <car...@wylog.com> wrote in message
news:bthi4v$ujm$1...@terabinaries.xmission.com...

>
> Please help!
>
> 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".

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


Paul Watson

unread,
Jan 7, 2004, 2:01:02 PM1/7/04
to
something like

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 #

Captain Pedantic

unread,
Jan 7, 2004, 2:15:17 PM1/7/04
to

"Paul Watson" <pa...@oninit.com> wrote in message
news:3FFC576E...@oninit.com...

> something like
>
> onstat -r <<EOF
> y
> n
> n
> n
> EOF
>
> should work, but I wouldn't use it on a production system

onstat -r would be quite safe on a production system.
I wouldn't use ontape on one though ...


Paul Watson

unread,
Jan 7, 2004, 3:11:22 PM1/7/04
to

OK,OK :-)

Andy Kent

unread,
Jan 8, 2004, 6:08:07 AM1/8/04
to
Why ever would you want to run a cold restore unattended?

Great laxative ...


"Carmen Constantinescu" <car...@wylog.com> wrote in message news:<bthi4v$ujm$1...@terabinaries.xmission.com>...

Curtis Crowson

unread,
Jan 8, 2004, 9:57:17 AM1/8/04
to
andykent...@virgin.net (Andy Kent) wrote in message news:<a3525a11.04010...@posting.google.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.

David Williams

unread,
Jan 7, 2004, 7:41:13 PM1/7/04
to

"Andy Kent" <andykent...@virgin.net> wrote in message
news:a3525a11.04010...@posting.google.com...

> Why ever would you want to run a cold restore unattended?
>
> Great laxative ...
>

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!


Colin Bull

unread,
Jan 9, 2004, 4:14:06 AM1/9/04
to

David Williams wrote
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

Colin Bull
c.b...@videonetworks.com

sending to informix-list

Christian Knappke

unread,
Jan 9, 2004, 5:20:08 AM1/9/04
to
"Colin Bull" <c.b...@videonetworks.com> wrote:

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

Colin Bull

unread,
Jan 9, 2004, 8:50:11 AM1/9/04
to

Christian Knappke wrote

>
> "Colin Bull" <c.b...@videonetworks.com> wrote:
>
> > 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
> '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)
>

That will make it a lot tidier, should be able to use a case statement.
I will revise next week sometime.

David Williams

unread,
Jan 9, 2004, 4:03:37 PM1/9/04
to

"Colin Bull" <c.b...@videonetworks.com> wrote in message news:btmcr4> 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

S.Dhayanidhi

unread,
Jan 11, 2004, 11:35:48 PM1/11/04
to
Here is my cute little code.. for unattended tape restore.
We do restore to our development everyday and it works fine.


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

unread,
Jan 12, 2004, 3:32:06 AM1/12/04
to

Thanks a lot !
My problem was the fact that I tried to restore on a Linux machine a backup
made on a UNIX machine. The INFORMIX server version was the same.
The problem was the OS, in fact.
Backup with ontape is recommended only when the restore is made on the same
machine.

Carmen

sending to informix-list

Obnoxio The Clown

unread,
Jan 12, 2004, 4:13:15 AM1/12/04
to
S.Dhayanidhi wrote:

> 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

Neil Truby

unread,
Jan 12, 2004, 5:08:21 AM1/12/04
to
"Carmen Constantinescu" <car...@wylog.com> wrote in message
news:bttmgl$jb1$1...@terabinaries.xmission.com...

>
> My problem was the fact that I tried to restore on a Linux machine a
backup
> made on a UNIX machine. The INFORMIX server version was the same.
> The problem was the OS, in fact.
> Backup with ontape is recommended only when the restore is made on the
same
> machine.

Apart from that, Carmen, how did you enjoy the play?


0 new messages