What is the difference between gbak and just copying the database file?

By: Borland Staff

Abstract: Copying the file is not safe while other users are using the database

I want to make a backup copy of my database.  Can I just make a copy
of my database in the operating system?  Why or why not?

Note: This information is relevant to all versions of InterBase.

A gbak (or backup in server manager--same thing) is like doing SELECT *
from every table and writing it out.  Note this has a few effects:  it's
safe to do it while other people are writing to the database, and it
fetches only a snapshot of the database, not all the obsolete garbage.

It's not safe to use a file copy to backup a gdb if it is currently in
use.  It takes a few moments to copy a large file, and in that time
someone using the database might change some data.  Since InterBase
stores various pointers and transaction inventories in multiple places
in the database, your file copy is susceptible to copying the latter
portion of the database after the user change, without getting the
updated first portion of the file.

As an analogy, say you are photocopying a large book (with permission of
course).  You get through half the book, and then the author gives you a
new copy, saying that he made some minor changes.  You take the new copy
and resume photocopying on page 500 where you left off.  When you get to
the index at the back of the book, there are entries that refer to page
280 but in your photocopy there is no such item on page 280.  Some other
index items refer to pages one off from where they should be, etc.

Source: Bill Karwin

Server Response from: ETNASC01