Understanding backups

When a database shuts down cleanly, the database file holds a complete and current copy of all the data in the database. When a database is running, however, the database file is generally not current or complete.

The only time a database file is guaranteed to hold a complete and current copy of all data is immediately after a checkpoint completes. Following a checkpoint, all the contents of the database cache are on disk.

The database server checkpoints a database under the following conditions:

  • As part of the database shutdown operations

  • When the amount of time since the last checkpoint exceeds the setting of the -gc server option

  • When the estimated time to do a recovery operation exceeds the setting of the -gr server option

  • When the database server is idle long enough to write all dirty pages

  • When certain DDL statements (such as ALTER TABLE, DROP TABLE, DROP INDEX, LOAD TABLE, or BACKUP) are executed

  • When a connection issues a CHECKPOINT statement

  • When the database server is running without a transaction log and a transaction is committed

To ensure that you have a complete copy of all committed transactions between checkpoints, you need the database file and the transaction log.

See also