Subject Re: [IBO] Backup and restore of a database
Author Lester Caine
First - you will get more help on the basic IB/FB stuff on
ib-support

> I'm looking to automatically backup and restore a database after an upgrade.
>
> My first attempt at achieving this has met with almost complete failure.
> My approach has been as follows:
> 1. Backup the database (db1.gdb).

gbak will produce a clean copy of all comitted records even
if users are connected. What will be missing is any work
started after gbak started. There should be NO corruptions.

> 2. Restore to another file (db2.gdb)

This should be fine - you can not restore to the original
unless you have exclusive access.

> 3. Copy db1.gdb to db1.gdb.bak
> 4. Copy db2.gdb to db1.gdb

No way these will work, unless there are NO connections to
the files.

> Unfortunately, this approach has produced a significantly high number of
> corrupt databases. I believe it is to do with the fact that I'm copying a
> database, that could potentially have a number of connections open while
> this is going on.

gbak is designed to work under those conditions - we have no
problem with it.

> I want to introduce more tests, etc that will guarantee a non-corrupt
> database at the end of the process. This should be the original file if the
> backup and resotre was not successful. I would like to be able to do this
> on a remote machine except, I don't trust the backups produced (there is no
> guarantee they will restore) and I am not really prepared to wait for the
> database to restore to a temp location and then restore to the location I
> want...
>
> What do others do to regularly maintain their databases? Is a backup and
> restore enough? How do you guarantee the system is not in use when you
> start a backup and restore? How do you stop someone from using your system
> once the backup and restore has been started?

Since switching to IBO, I don't think we have resorted to a
restore. Backup happens every night, and is copied to a
slave machine, following a sweep of the main database, and
we only restore if there has been a problem - which has not
happened for a while. Weekly maintenance restores a backup
to check integrity, but that copy is not used.

Upgrades are a slightly different matter. We always create a
new blank database, and pump the data from the old one, then
just start using the new one.

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services